Skip to content

Commit

Permalink
Merge branch 'main' into mleoni/add_xdmffile_read_function
Browse files Browse the repository at this point in the history
  • Loading branch information
mleoni-pf authored Jan 7, 2025
2 parents 3e50555 + fb0b994 commit bd1fc79
Show file tree
Hide file tree
Showing 83 changed files with 2,246 additions and 1,492 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
4 changes: 2 additions & 2 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
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: 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
31 changes: 17 additions & 14 deletions cpp/dolfinx/common/sort.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,31 +20,29 @@

namespace dolfinx
{

struct __radix_sort
{

/// @brief Sort a range with radix sorting algorithm. The bucket
/// size is determined by the number of bits to sort at a time (2^BITS).
/// @brief Sort a range with radix sorting algorithm. The bucket size
/// is determined by the number of bits to sort at a time (2^BITS).
///
/// This allows usage with standard range containers of integral types, for
/// example
/// This allows usage with standard range containers of integral
/// types, for example
/// @code
/// std::array<std::int16_t, 3> a{2, 3, 1};
/// dolfixn::radix_sort(a); // a = {1, 2, 3}
/// @endcode
/// Additionally the projection based approach of the STL library is adpated,
/// which allows for versatile usage, for example the easy realization of an
/// argsort
/// Additionally the projection based approach of the STL library is
/// adapted, which allows for versatile usage, for example the easy
/// realization of an argsort
/// @code
/// std::array<std::int16_t, 3> a{2, 3, 1};
/// std::array<std::int16_t, 3> i{0, 1, 2};
/// dolfixn::radix_sort(i, [&](auto i){ return a[i]; }); // yields i = {2, 0,
/// 1} and a[i] = {1, 2, 3};
/// @endcode
/// @tparam R Type of range to be sorted.
/// @tparam P Projection type to be applied on range elements to produce a
/// sorting index.
/// @tparam P Projection type to be applied on range elements to
/// produce a sorting index.
/// @tparam BITS The number of bits to sort at a time.
/// @param[in, out] range The range to sort.
/// @param[in] P Element projection.
Expand Down Expand Up @@ -126,16 +124,21 @@ inline constexpr __radix_sort radix_sort{};
/// @brief Compute the permutation array that sorts a 2D array by row.
///
/// @param[in] x The flattened 2D array to compute the permutation array
/// for.
/// for (row-major storage).
/// @param[in] shape1 The number of columns of `x`.
/// @return The permutation array such that `x[perm[i]] <= x[perm[i +1]].
/// @return The permutation array such that `x[perm[i]] <= x[perm[i
/// +1]].
/// @pre `x.size()` must be a multiple of `shape1`.
/// @note This function is suitable for small values of `shape1`. Each
/// column of `x` is copied into an array that is then sorted.
template <typename T, int BITS = 16>
std::vector<std::int32_t> sort_by_perm(std::span<const T> x, std::size_t shape1)
{
static_assert(std::is_integral_v<T>, "Integral required.");

if (x.empty())
return std::vector<std::int32_t>{};

assert(shape1 > 0);
assert(x.size() % shape1 == 0);
const std::size_t shape0 = x.size() / shape1;
Expand All @@ -147,7 +150,7 @@ std::vector<std::int32_t> sort_by_perm(std::span<const T> x, std::size_t shape1)
std::vector<T> column(shape0);
for (std::size_t i = 0; i < shape1; ++i)
{
int col = shape1 - 1 - i;
std::size_t col = shape1 - 1 - i;
for (std::size_t j = 0; j < shape0; ++j)
column[j] = x[j * shape1 + col];

Expand Down
2 changes: 1 addition & 1 deletion cpp/dolfinx/fem/DirichletBC.h
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ class DirichletBC
if (g->shape.size() != V->element()->value_shape().size())
{
throw std::runtime_error(
"Rank mis-match between Constant and function space in DirichletBC");
"Rank mismatch between Constant and function space in DirichletBC");
}

if (g->value.size() != _function_space->dofmap()->bs())
Expand Down
10 changes: 5 additions & 5 deletions cpp/dolfinx/fem/FiniteElement.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ struct BasixElementData
element; ///< Finite element.
std::optional<std::vector<std::size_t>> value_shape
= std::nullopt; ///< Value shape. Can only be set for scalar `element`.
bool symmetry = false; ///< Symmetry. Should ony set set for 2nd-order tensor
bool symmetry = false; ///< Symmetry. Should only set set for 2nd-order tensor
///< blocked elements.
};

Expand All @@ -65,8 +65,8 @@ class FiniteElement
/// for a vector in 3D or `{2, 2}` for a rank-2 tensor in 2D. Can only
/// be set for blocked scalar `element`. For other elements and scalar
/// elements it should be `std::nullopt`.
/// @param[in] symmetric Is the element a symmetric tensor? Should ony
/// set for 2nd-order tensor blocked elements.
/// @param[in] symmetric Is the element a symmetric tensor? Should
/// only set for 2nd-order tensor blocked elements.
FiniteElement(const basix::FiniteElement<geometry_type>& element,
std::optional<std::vector<std::size_t>> value_shape
= std::nullopt,
Expand Down Expand Up @@ -792,7 +792,7 @@ class FiniteElement
/// consistent physical element degree-of-freedom ordering. The
/// permutation is computed in-place.
///
/// @param[in,out] doflist Indicies associated with the
/// @param[in,out] doflist Indices associated with the
/// degrees-of-freedom. Size=`num_dofs`.
/// @param[in] cell_permutation Permutation data for the cell.
void permute(std::span<std::int32_t> doflist,
Expand All @@ -811,7 +811,7 @@ class FiniteElement
/// element degree-of-freedom ordering. The permutation is computed
/// in-place.
///
/// @param[in,out] doflist Indicies associated with the
/// @param[in,out] doflist Indices associated with the
/// degrees-of-freedom. Size=`num_dofs`.
/// @param[in] cell_permutation Permutation data for the cell.
void permute_inv(std::span<std::int32_t> doflist,
Expand Down
10 changes: 5 additions & 5 deletions cpp/dolfinx/fem/Form.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ struct integral_data
/// @param[in] id Domain ID.
/// @param[in] kernel Integration kernel.
/// @param[in] entities Indices of entities to integrate over.
/// @param[in] coeffs Indicies of the coefficients are present
/// (active) in `kernel`.
/// @param[in] coeffs Indices of the coefficients are present (active)
/// in `kernel`.
template <typename K, typename V, typename W>
requires std::is_convertible_v<
std::remove_cvref_t<K>,
Expand All @@ -70,11 +70,11 @@ struct integral_data
/// @param[in] id Domain ID.
/// @param[in] kernel Integration kernel.
/// @param[in] entities Indices of entities to integrate over.
/// @param[in] coeffs Indicies of the coefficients that are active in
/// @param[in] coeffs Indices of the coefficients that are active in
/// the `kernel`.
///
/// @note This version allows `entities` to be passed as a std::span,
/// which is then copied.
/// @note This version allows `entities` to be passed as a
/// `std::span`, which is then copied.
template <typename K, typename W>
requires std::is_convertible_v<
std::remove_cvref_t<K>,
Expand Down
8 changes: 4 additions & 4 deletions cpp/dolfinx/fem/assemble_matrix_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ void assemble_cells(
P1T(_Ae, cell_info1, c1, ndim0); // A = B P1_T

// Zero rows/columns for essential bcs
auto dofs0 = std::span(dmap0.data_handle() + c0 * num_dofs0, num_dofs0);
auto dofs1 = std::span(dmap1.data_handle() + c1 * num_dofs1, num_dofs1);
std::span dofs0(dmap0.data_handle() + c0 * num_dofs0, num_dofs0);
std::span dofs1(dmap1.data_handle() + c1 * num_dofs1, num_dofs1);

if (!bc0.empty())
{
Expand Down Expand Up @@ -255,8 +255,8 @@ void assemble_exterior_facets(
P1T(_Ae, cell_info1, cell1, ndim0);

// Zero rows/columns for essential bcs
auto dofs0 = std::span(dmap0.data_handle() + cell0 * num_dofs0, num_dofs0);
auto dofs1 = std::span(dmap1.data_handle() + cell1 * num_dofs1, num_dofs1);
std::span dofs0(dmap0.data_handle() + cell0 * num_dofs0, num_dofs0);
std::span dofs1(dmap1.data_handle() + cell1 * num_dofs1, num_dofs1);
if (!bc0.empty())
{
for (int i = 0; i < num_dofs0; ++i)
Expand Down
Loading

0 comments on commit bd1fc79

Please sign in to comment.