Skip to content

Commit

Permalink
Merge branch 'main' into mleoni/make_read_meshtags_a_template_function
Browse files Browse the repository at this point in the history
  • Loading branch information
mleoni-pf authored Jan 7, 2025
2 parents 087e384 + fb0b994 commit 750f3f9
Show file tree
Hide file tree
Showing 103 changed files with 2,497 additions and 1,683 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/oneapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
conda list
- name: Install Basix
run: pip install --no-build-isolation git+https://github.com/FEniCS/basix.git@${{ needs.fenicsx-refs.outputs.basix_ref }}
run: uv pip install --no-build-isolation git+https://github.com/FEniCS/basix.git@${{ needs.fenicsx-refs.outputs.basix_ref }}

- name: Clone FFCx
uses: actions/checkout@v4
Expand All @@ -82,8 +82,8 @@ jobs:
- name: Install UFL and FFCx modules
run: |
pip install --no-build-isolation git+https://github.com/FEniCS/ufl.git@${{ needs.fenicsx-refs.outputs.ufl_ref }}
pip install --no-build-isolation ffcx/
uv pip install --no-build-isolation git+https://github.com/FEniCS/ufl.git@${{ needs.fenicsx-refs.outputs.ufl_ref }}
uv pip install --no-build-isolation ffcx/
- name: Build and run DOLFINx C++ unit tests (serial and MPI)
run: |
Expand All @@ -102,7 +102,7 @@ jobs:
ctest -R demo -R mpi_2
- name: Build DOLFINx Python interface
run: pip -v install --check-build-dependencies --no-build-isolation --config-settings=cmake.build-type="Developer" python/
run: uv pip -v install --no-build-isolation --config-settings=cmake.build-type="Developer" python/
- name: Run DOLFINx demos (Python, serial)
run: python -m pytest -v -n=2 -m serial --durations=10 python/demo/test.py
- name: Run DOLFINx demos (Python, MPI (np=2))
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ jobs:
(Get-Content __init__.py).Replace('# WINDOWSDLL', 'import os; os.add_dll_directory("D:/a/dolfinx/dolfinx-install/bin"); os.add_dll_directory("C:/Program Files (x86)/Intel/oneAPI/mpi/2021.12/opt/mpi/libfabric/bin")') | Set-Content __init__.py
Get-Content __init__.py
- uses: mpi4py/[email protected].7
- uses: mpi4py/[email protected].8
with:
mpi: "intelmpi"

Expand Down
24 changes: 12 additions & 12 deletions ChangeLog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ solver <https://bitbucket.org/fenics-project/dolfin/>`_.
- Remove ``Mesh::size``. Use ``Mesh::num_entities`` instead.
- Improved mesh topology computation performance.
- Remove excessive calls to MPI init. It may now be necessary in some
cases to explicitly intialise MPI.
cases to explicitly initialise MPI.
- Improvements to sparsity pattern computation.
- Addition of some interfaces using ``Eigen::Map/ref`` in addition to
``dolfin::Array(View)``. ``dolfin::Array(View)``interfaces will be
Expand Down Expand Up @@ -146,7 +146,7 @@ solver <https://bitbucket.org/fenics-project/dolfin/>`_.
- Require polynomial degree or finite element for Expressions in the
Python interface (fixes Issue #355,
https://bitbucket.org/fenics-project/dolfin/issues/355)
- Switch to Google Test framwork for C++ unit tests
- Switch to Google Test framework for C++ unit tests
- Fix bug when reading domain data from mesh file for a ghosted mesh
- Add interface for manipulating mesh geometry using (higher-order) FE
functions: free functions set_coordinates, get_coordinates,
Expand Down Expand Up @@ -223,7 +223,7 @@ solver <https://bitbucket.org/fenics-project/dolfin/>`_.
#443)
- Add quadrature rules for multimesh/cut-cell integration up to order
6
- Implement MPI reductions and XML ouput of Table class
- Implement MPI reductions and XML output of Table class
- list_timings() is now collective and returns MPI average across
processes
- Add dump_timings_to_xml()
Expand Down Expand Up @@ -324,7 +324,7 @@ solver <https://bitbucket.org/fenics-project/dolfin/>`_.
module
- Add function Form::set_some_coefficients()
- Remove Boost.MPI dependency
- Change GenericMatrix::compresss to return a new matrix (7be3a29)
- Change GenericMatrix::compress to return a new matrix (7be3a29)
- Add function GenericTensor::empty()
- Deprecate resizing of linear algebra via the GenericFoo interfaces
(fixes #213)
Expand Down Expand Up @@ -387,7 +387,7 @@ solver <https://bitbucket.org/fenics-project/dolfin/>`_.
- Fixes bug where child/parent hierarchy in Python were destroyed
- Add utility script dolfin-get-demos
- MeshFunctions in python now support iterable protocol
- Add timed VTK output for Mesh and MeshFunction in addtion to
- Add timed VTK output for Mesh and MeshFunction in addition to
Functions
- Expose ufc::dofmap::tabulate_entity_dofs to GenericDofMap interface
- Expose ufc::dofmap::num_entity_dofs to GenericDofMap interface
Expand Down Expand Up @@ -477,7 +477,7 @@ solver <https://bitbucket.org/fenics-project/dolfin/>`_.
- Add sparray method in the Python interface of GenericMatrix,
requires scipy.sparse
- Make methods that return a view of contiguous c-arrays, via a NumPy
array, keep a reference from the object so it wont get out of scope
array, keep a reference from the object so it won't get out of scope
- Add parameter: "use_petsc_signal_handler", which enables/disable
PETSc system signals
- Avoid unnecessary resize of result vector for A*b
Expand Down Expand Up @@ -684,7 +684,7 @@ solver <https://bitbucket.org/fenics-project/dolfin/>`_.
- Thread-safe fixed in Function class
- Make GenericFunction::eval thread-safe (Data class removed)
- Optimize and speedup topology computation (mesh.init())
- Add function Mesh::clean() for cleaning out auxilliary topology data
- Add function Mesh::clean() for cleaning out auxiliary topology data
- Improve speed and accuracy of timers
- Fix bug in 3D uniform mesh refinement
- Add built-in meshes UnitTriangle and UnitTetrahedron
Expand Down Expand Up @@ -761,7 +761,7 @@ solver <https://bitbucket.org/fenics-project/dolfin/>`_.
refinement
- Add functionality for smoothing the boundary of a mesh
- Speedup assembly over exterior facets by not using BoundaryMesh
- Mesh refinement improvements, remove unecessary copying in Python
- Mesh refinement improvements, remove unnecessary copying in Python
interface
- Clean PETSc and Epetra Krylov solvers
- Add separate preconditioner classes for PETSc and Epetra solvers
Expand Down Expand Up @@ -935,7 +935,7 @@ solver <https://bitbucket.org/fenics-project/dolfin/>`_.
check range
- Add unit tests to the memorycheck
- Add call to clean up libxml2 parser at exit
- Remove unecessary arguments in DofMap member functions
- Remove unnecessary arguments in DofMap member functions
- Remove reference constructors from DofMap, FiniteElement and
FunctionSpace
- Use a shared_ptr to store the mesh in DofMap objects
Expand Down Expand Up @@ -1215,7 +1215,7 @@ solver <https://bitbucket.org/fenics-project/dolfin/>`_.
- Disable PETSc by default, use --enable-petsc to enable
- Modify ODE solver interface for u0() and f()
- Add class ConvectionMatrix
- Readd classes LoadVector, MassMatrix, StiffnessMatrix
- Read classes LoadVector, MassMatrix, StiffnessMatrix
- Add matrix factory for simple creation of standard finite element
matrices
- Collect static solvers in LU and GMRES
Expand Down Expand Up @@ -1500,7 +1500,7 @@ solver <https://bitbucket.org/fenics-project/dolfin/>`_.
- Update PETSc wrappers NewVector, NewMatrix, and NewGMRES
- Fix initialization of PETSc
- Add mono-adaptive cG(q) and dG(q) solvers (experimental)
- Implementation of new assebly: NewFEM, using output from FFC
- Implementation of new assembly: NewFEM, using output from FFC
- Add access to mesh for nodes, cells, faces and edges
- Add Tecplot I/O interface; contributed by Garth N. Wells

Expand Down Expand Up @@ -1623,7 +1623,7 @@ solver <https://bitbucket.org/fenics-project/dolfin/>`_.
- Optimize Lagrange polynomials
- Optimize sparsity: use stl containers
- Optimize choice of discrete residual for multi-adaptive solver
- Don't save solution in benchmark proble
- Don't save solution in benchmark problem
- Improve computation of divergence factor for underdamped systems
- Don't check residual on first slab for fixed time step
- Decrease largest (default) time step to 0.1
Expand Down
22 changes: 6 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ DOLFINx is the computational environment of
Solving Environment in C++ and Python. DOLFINx is a new version of
DOLFIN and is actively developed.

For questions about using DOLFINx, visit the [FEniCS
Discourse](https://fenicsproject.discourse.group/) page or use the
[FEniCS Slack channel](https://fenicsproject.slack.com/) (use
[this](https://join.slack.com/t/fenicsproject/shared_invite/zt-1lraknsp1-6_3Js5kueDIyWgF192d3nA)
link to sign up to the Slack channel).

## Documentation

Documentation can be viewed at <https://docs.fenicsproject.org>.
Expand Down Expand Up @@ -191,19 +197,3 @@ Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with DOLFINx. If not, see
<https://www.gnu.org/licenses/>.

## Contact

For questions about using DOLFINx, visit the FEniCS Discourse page:

<https://fenicsproject.discourse.group/>

or use the FEniCS Slack channel:

<https://fenicsproject.slack.com/>

(use <https://join.slack.com/t/fenicsproject/shared_invite/zt-1lraknsp1-6_3Js5kueDIyWgF192d3nA> to sign up)

For bug reports visit:

<https://github.com/FEniCS/dolfinx>
2 changes: 1 addition & 1 deletion cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ if(NOT DOLFINX_UFCX_PYTHON)
# Check in CONFIG mode, i.e. look for installed ufcxConfig.cmake
find_package(ufcx 0.10 REQUIRED CONFIG)
else()
# Check in MODULE mode (using FindUFCX.cmake) using Python intepreter.
# Check in MODULE mode (using FindUFCX.cmake) using Python interpreter.
find_package(
Python3
COMPONENTS Interpreter
Expand Down
8 changes: 4 additions & 4 deletions cpp/doc/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ CREATE_SUBDIRS = YES
# level increment doubles the number of directories, resulting in 4096
# directories at level 8 which is the default and also the maximum value. The
# sub-directories are organized in 2 levels, the first level always has a fixed
# numer of 16 directories.
# number of 16 directories.
# Minimum value: 0, maximum value: 8, default value: 8.
# This tag requires that the tag CREATE_SUBDIRS is set to YES.

Expand Down Expand Up @@ -1007,7 +1007,7 @@ RECURSIVE = YES
# Note that relative paths are relative to the directory from which doxygen is
# run.

# EXCLUDE =
# EXCLUDE =

# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
# directories that are symbolic links (a Unix file system feature) are excluded
Expand Down Expand Up @@ -2268,7 +2268,7 @@ PERLMOD_MAKEVAR_PREFIX =
# C-preprocessor directives found in the sources and include files.
# The default value is: YES.

ENABLE_PREPROCESSING = NO
ENABLE_PREPROCESSING = YES

# If the MACRO_EXPANSION tag is set to YES, doxygen will expand all macro names
# in the source code. If set to NO, only conditional compilation will be
Expand All @@ -2285,7 +2285,7 @@ MACRO_EXPANSION = YES
# The default value is: NO.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.

EXPAND_ONLY_PREDEF = YES
EXPAND_ONLY_PREDEF = NO

# If the SEARCH_INCLUDES tag is set to YES, the include files in the
# INCLUDE_PATH will be searched if a #include is found.
Expand Down
2 changes: 1 addition & 1 deletion cpp/doc/source/jupytext_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def process():
with open(myst_file, "w") as fw:
fw.write(cpp_myst_text)

# There is a posibility to use jupyter-notebooks with C++/C kernels
# There is a possibility to use jupyter-notebooks with C++/C kernels
# ipynb_file = (demo_doc_dir / fname.name).with_suffix(".ipynb")
# jupytext.write(cpp_demo, ipynb_file, fmt="ipynb")

Expand Down
2 changes: 0 additions & 2 deletions cpp/dolfinx/common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ set(HEADERS_common
${CMAKE_CURRENT_SOURCE_DIR}/Table.h
${CMAKE_CURRENT_SOURCE_DIR}/Timer.h
${CMAKE_CURRENT_SOURCE_DIR}/TimeLogger.h
${CMAKE_CURRENT_SOURCE_DIR}/TimeLogManager.h
${CMAKE_CURRENT_SOURCE_DIR}/timing.h
${CMAKE_CURRENT_SOURCE_DIR}/utils.h
PARENT_SCOPE
Expand All @@ -26,6 +25,5 @@ target_sources(
${CMAKE_CURRENT_SOURCE_DIR}/MPI.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Table.cpp
${CMAKE_CURRENT_SOURCE_DIR}/TimeLogger.cpp
${CMAKE_CURRENT_SOURCE_DIR}/TimeLogManager.cpp
${CMAKE_CURRENT_SOURCE_DIR}/timing.cpp
)
2 changes: 1 addition & 1 deletion cpp/dolfinx/common/IndexMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ compute_submap_indices(const IndexMap& imap,
// If required, preserve the order of the ghost indices
if (order == IndexMapOrder::preserve)
{
// Build (old postion, new position) list for ghosts and sort
// Build (old position, new position) list for ghosts and sort
std::vector<std::pair<std::int32_t, std::int32_t>> pos;
pos.reserve(submap_ghost.size());
for (std::int32_t idx : submap_ghost)
Expand Down
77 changes: 40 additions & 37 deletions cpp/dolfinx/common/MPI.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2007-2023 Magnus Vikstrøm and Garth N. Wells
// Copyright (C) 2007-2023 Magnus Vikstrøm, Garth N. Wells and Paul T. Kühner
//
// This file is part of DOLFINx (https://www.fenicsproject.org)
//
Expand Down Expand Up @@ -271,39 +271,42 @@ struct dependent_false : std::false_type
};

/// MPI Type

/// @brief Type trait for MPI type conversions.
template <typename T>
constexpr MPI_Datatype mpi_type()
{
if constexpr (std::is_same_v<T, float>)
return MPI_FLOAT;
else if constexpr (std::is_same_v<T, double>)
return MPI_DOUBLE;
else if constexpr (std::is_same_v<T, std::complex<double>>)
return MPI_C_DOUBLE_COMPLEX;
else if constexpr (std::is_same_v<T, std::complex<float>>)
return MPI_C_FLOAT_COMPLEX;
else if constexpr (std::is_same_v<T, short int>)
return MPI_SHORT;
else if constexpr (std::is_same_v<T, int>)
return MPI_INT;
else if constexpr (std::is_same_v<T, unsigned int>)
return MPI_UNSIGNED;
else if constexpr (std::is_same_v<T, long int>)
return MPI_LONG;
else if constexpr (std::is_same_v<T, unsigned long>)
return MPI_UNSIGNED_LONG;
else if constexpr (std::is_same_v<T, long long>)
return MPI_LONG_LONG;
else if constexpr (std::is_same_v<T, unsigned long long>)
return MPI_UNSIGNED_LONG_LONG;
else if constexpr (std::is_same_v<T, bool>)
return MPI_C_BOOL;
else if constexpr (std::is_same_v<T, std::int8_t>)
return MPI_INT8_T;
else
// Issue compile time error
static_assert(!std::is_same_v<T, T>);
}
struct mpi_type_mapping;

/// @brief Retrieves the MPI data type associated to the provided type.
/// @tparam T cpp type to map
template <typename T>
MPI_Datatype mpi_t = mpi_type_mapping<T>::type;

/// @brief Registers for cpp_t the corresponding mpi_t which can then be
/// retrieved with mpi_t<cpp_t> from here on.
#define MAP_TO_MPI_TYPE(cpp_t, mpi_t) \
template <> \
struct mpi_type_mapping<cpp_t> \
{ \
static inline MPI_Datatype type = mpi_t; \
};

/// @defgroup MPI type mappings
/// @{
/// @cond
MAP_TO_MPI_TYPE(float, MPI_FLOAT)
MAP_TO_MPI_TYPE(double, MPI_DOUBLE)
MAP_TO_MPI_TYPE(std::complex<float>, MPI_C_FLOAT_COMPLEX)
MAP_TO_MPI_TYPE(std::complex<double>, MPI_C_DOUBLE_COMPLEX)
MAP_TO_MPI_TYPE(std::int8_t, MPI_INT8_T)
MAP_TO_MPI_TYPE(std::int16_t, MPI_INT16_T)
MAP_TO_MPI_TYPE(std::int32_t, MPI_INT32_T)
MAP_TO_MPI_TYPE(std::int64_t, MPI_INT64_T)
MAP_TO_MPI_TYPE(std::uint8_t, MPI_UINT8_T)
MAP_TO_MPI_TYPE(std::uint16_t, MPI_UINT16_T)
MAP_TO_MPI_TYPE(std::uint32_t, MPI_UINT32_T)
MAP_TO_MPI_TYPE(std::uint64_t, MPI_UINT64_T)
/// @endcond
/// @}

//---------------------------------------------------------------------------
template <typename U>
Expand Down Expand Up @@ -434,7 +437,7 @@ distribute_to_postoffice(MPI_Comm comm, const U& x,

// Send/receive data (x)
MPI_Datatype compound_type;
MPI_Type_contiguous(shape[1], dolfinx::MPI::mpi_type<T>(), &compound_type);
MPI_Type_contiguous(shape[1], dolfinx::MPI::mpi_t<T>, &compound_type);
MPI_Type_commit(&compound_type);
std::vector<T> recv_buffer_data(shape[1] * recv_disp.back());
err = MPI_Neighbor_alltoallv(
Expand Down Expand Up @@ -616,7 +619,7 @@ distribute_from_postoffice(MPI_Comm comm, std::span<const std::int64_t> indices,
dolfinx::MPI::check_error(comm, err);

MPI_Datatype compound_type0;
MPI_Type_contiguous(shape[1], dolfinx::MPI::mpi_type<T>(), &compound_type0);
MPI_Type_contiguous(shape[1], dolfinx::MPI::mpi_t<T>, &compound_type0);
MPI_Type_commit(&compound_type0);

std::vector<T> recv_buffer_data(shape[1] * send_disp.back());
Expand Down Expand Up @@ -691,8 +694,8 @@ distribute_data(MPI_Comm comm0, std::span<const std::int64_t> indices,
if (comm1 != MPI_COMM_NULL)
{
rank_offset = 0;
err = MPI_Exscan(&shape0_local, &rank_offset, 1, MPI_INT64_T, MPI_SUM,
comm1);
err = MPI_Exscan(&shape0_local, &rank_offset, 1,
dolfinx::MPI::mpi_t<std::int64_t>, MPI_SUM, comm1);
dolfinx::MPI::check_error(comm1, err);
}
else
Expand Down
Loading

0 comments on commit 750f3f9

Please sign in to comment.