DOLFINx 0.12.0.0
DOLFINx C++
Loading...
Searching...
No Matches
Function.h
1// Copyright (C) 2003-2026 Anders Logg, Garth N. Wells and Massimiliano Leoni
2//
3// This file is part of DOLFINx (https://www.fenicsproject.org)
4//
5// SPDX-License-Identifier: LGPL-3.0-or-later
6
7#pragma once
8
9#include "DofMap.h"
10#include "FiniteElement.h"
11#include "FunctionSpace.h"
12#include "interpolate.h"
13#include <algorithm>
14#include <basix/mdspan.hpp>
15#include <concepts>
16#include <dolfinx/common/IndexMap.h>
17#include <dolfinx/common/types.h>
18#include <dolfinx/la/Vector.h>
19#include <dolfinx/mesh/Geometry.h>
20#include <dolfinx/mesh/Mesh.h>
21#include <dolfinx/mesh/Topology.h>
22#include <functional>
23#include <memory>
24#include <numeric>
25#include <span>
26#include <stdexcept>
27#include <string>
28#include <utility>
29#include <vector>
30
31namespace dolfinx::fem
32{
42template <dolfinx::scalar T, std::floating_point U = dolfinx::scalar_value_t<T>>
44{
45public:
48 using value_type = T;
50 using geometry_type = U;
51
55 explicit Function(std::shared_ptr<const FunctionSpace<geometry_type>> V,
56 std::string name = "u")
57 : name(std::move(name)), _function_space(V),
58 _x(std::make_shared<la::Vector<value_type>>(
59 V->dofmaps().front()->index_map,
60 V->dofmaps().front()->index_map_bs()))
61 {
62 if (!V->component().empty())
63 {
64 throw std::invalid_argument(
65 "Cannot create Function from subspace. Consider "
66 "collapsing the function space");
67 }
68 }
69
79 Function(std::shared_ptr<const FunctionSpace<geometry_type>> V,
80 std::shared_ptr<la::Vector<value_type>> x, std::string name = "u")
81 : name(std::move(name)), _function_space(V), _x(x)
82 {
83 // NOTE: We do not check for a subspace since this constructor is
84 // used for creating subfunctions
85
86 // Assertion uses '<=' to deal with sub-functions
87 assert(V->dofmap());
88 assert(V->dofmap()->index_map->size_global() * V->dofmap()->index_map_bs()
89 <= _x->bs() * _x->index_map()->size_global());
90 }
91
92 // Copy constructor
93 Function(const Function& v) = delete;
94
96 Function(Function&& v) = default;
97
99 ~Function() = default;
100
102 Function& operator=(Function&& v) = default;
103
104 // Assignment
105 Function& operator=(const Function& v) = delete;
106
110 Function sub(int i) const
111 {
112 auto sub_space = std::make_shared<FunctionSpace<geometry_type>>(
113 _function_space->sub({i}));
114 assert(sub_space);
115 return Function(sub_space, _x);
116 }
117
122 {
123 // Create new collapsed FunctionSpace
124 auto [V, map] = _function_space->collapse();
125
126 // Create new vector
127 auto x = std::make_shared<la::Vector<value_type>>(
128 V.dofmap()->index_map, V.dofmap()->index_map_bs());
129
130 // Copy values into new vector
131 std::span<const value_type> x_old = _x->array();
132 std::span<value_type> x_new = x->array();
133 for (auto mapj : map)
134 {
135 for (std::size_t i = 0; i < mapj.size(); ++i)
136 {
137 assert(i < x_new.size());
138 assert(static_cast<std::size_t>(mapj[i]) < x_old.size());
139 x_new[i] = x_old[mapj[i]];
140 }
141 }
142
143 return Function(
144 std::make_shared<FunctionSpace<geometry_type>>(std::move(V)), x);
145 }
146
149 std::shared_ptr<const FunctionSpace<geometry_type>> function_space() const
150 {
151 return _function_space;
152 }
153
155 std::shared_ptr<const la::Vector<value_type>> x() const { return _x; }
156
158 std::shared_ptr<la::Vector<value_type>> x() { return _x; }
159
165 const std::function<
166 std::pair<std::vector<value_type>, std::vector<std::size_t>>(
167 md::mdspan<const geometry_type,
168 md::extents<std::size_t, 3, md::dynamic_extent>>)>& f,
169 mesh::CellRange auto&& cells)
170 {
171 assert(_function_space);
172 assert(_function_space->element());
173 assert(_function_space->mesh());
174 const std::vector<geometry_type> x
176 *_function_space->element(), _function_space->mesh()->geometry(),
177 cells);
178 md::mdspan<const geometry_type,
179 md::extents<std::size_t, 3, md::dynamic_extent>>
180 x_view(x.data(), 3, x.size() / 3);
181
182 const auto [fx, fshape] = f(x_view);
183 assert(fshape.size() <= 2);
184 if (std::size_t vs = _function_space->element()->value_size();
185 vs == 1 and fshape.size() == 1)
186 {
187 // Check for scalar-valued functions
188 if (fshape.front() != x.size() / 3)
189 {
190 throw std::invalid_argument(
191 "Data returned by callable has wrong length");
192 }
193 }
194 else
195 {
196 // Check for vector/tensor value
197 if (fshape.size() != 2)
198 throw std::invalid_argument("Expected 2D array of data");
199
200 if (fshape[0] != vs)
201 {
202 throw std::invalid_argument(
203 "Data returned by callable has wrong shape(0) size");
204 }
205
206 if (fshape[1] != x.size() / 3)
207 {
208 throw std::invalid_argument(
209 "Data returned by callable has wrong shape(1) size");
210 }
211 }
212
213 std::array<std::size_t, 2> _fshape;
214 if (fshape.size() == 1)
215 _fshape = {1, fshape[0]};
216 else
217 _fshape = {fshape[0], fshape[1]};
218
219 fem::interpolate(*this, std::span<const value_type>(fx.data(), fx.size()),
220 _fshape, cells);
221 }
222
227 const std::function<
228 std::pair<std::vector<value_type>, std::vector<std::size_t>>(
229 md::mdspan<const geometry_type,
230 md::extents<std::size_t, 3, md::dynamic_extent>>)>& f)
231 {
232 assert(_function_space);
233 assert(_function_space->mesh());
234 int tdim = _function_space->mesh()->topology()->dim();
235 auto cmap = _function_space->mesh()->topology()->index_map(tdim);
236 assert(cmap);
237 std::int32_t num_cells = cmap->size_local() + cmap->num_ghosts();
238 interpolate(f, std::ranges::iota_view(0, num_cells));
239 }
240
257 mesh::CellRange auto&& cells0, mesh::CellRange auto&& cells1)
258 {
259 fem::interpolate(*this, cells1, u0, cells0);
260 }
261
269 mesh::CellRange auto&& cells)
270 {
271 fem::interpolate(*this, u, cells);
272 }
273
280 {
281 assert(_function_space);
282 assert(_function_space->mesh());
283 int tdim = _function_space->mesh()->topology()->dim();
284 auto cmap = _function_space->mesh()->topology()->index_map(tdim);
285 assert(cmap);
286 fem::interpolate(*this, u);
287 }
288
302 mesh::CellRange auto&& cells, double tol, int maxit,
303 const geometry::PointOwnershipData<U>& interpolation_data)
304 {
305 fem::interpolate(*this, u, cells, tol, maxit, interpolation_data);
306 }
307
324 void eval(std::span<const geometry_type> x, std::array<std::size_t, 2> xshape,
325 mesh::CellRange auto&& cells, std::span<value_type> u,
326 std::array<std::size_t, 2> ushape, double tol, int maxit) const
327 {
328 if (cells.empty())
329 return;
330
331 assert(x.size() == xshape[0] * xshape[1]);
332 assert(u.size() == ushape[0] * ushape[1]);
333
334 // TODO: This could be easily made more efficient by exploiting
335 // points being ordered by the cell to which they belong.
336
337 if (xshape[0] != cells.size())
338 {
339 throw std::invalid_argument(
340 "Number of points and number of cells must be equal.");
341 }
342
343 if (xshape[0] != ushape[0])
344 {
345 throw std::invalid_argument(
346 "Length of array for Function values must be the "
347 "same as the number of points.");
348 }
349
350 // Get mesh
351 assert(_function_space);
352 auto mesh = _function_space->mesh();
353 assert(mesh);
354 const std::size_t gdim = mesh->geometry().dim();
355 const std::size_t tdim = mesh->topology()->dim();
356 auto map = mesh->topology()->index_map(tdim);
357
358 // Get coordinate map
360 = mesh->geometry().cmaps().front();
361
362 // Get geometry data
363 auto x_dofmap = mesh->geometry().dofmaps().front();
364 const std::size_t num_dofs_g = cmap.dim();
365 auto x_g = mesh->geometry().x();
366
367 // Get element
368 auto element = _function_space->element();
369 assert(element);
370 const int bs_element = element->block_size();
371 const std::size_t reference_value_size = element->reference_value_size();
372 // Size of the push-forward output for one block. On a manifold a
373 // Piola-mapped element has gdim physical components and only tdim
374 // reference ones.
375 const std::size_t value_size = element->physical_base_value_size();
376 const std::size_t space_dimension = element->space_dimension() / bs_element;
377
378 // If the space has sub elements, concatenate the evaluations on the
379 // sub elements
380 const int num_sub_elements = element->num_sub_elements();
381 if (num_sub_elements > 1 and num_sub_elements != bs_element)
382 {
383 throw std::invalid_argument("Function::eval is not supported for mixed "
384 "elements. Extract subspaces.");
385 }
386
387 // Create work vector for expansion coefficients
388 std::vector<value_type> coefficients(space_dimension * bs_element);
389
390 // Get dofmap
391 std::shared_ptr<const DofMap> dofmap = _function_space->dofmap();
392 assert(dofmap);
393 const int bs_dof = dofmap->bs();
394
395 std::span<const std::uint32_t> cell_info;
396 if (element->needs_dof_transformations())
397 {
398 mesh->topology_mutable()->create_cell_permutations();
399 cell_info = std::span(mesh->topology()->get_cell_permutation_info());
400 }
401
402 std::vector<geometry_type> coord_dofs_b(num_dofs_g * gdim);
403 impl::mdspan_t<geometry_type, 2> coord_dofs(coord_dofs_b.data(), num_dofs_g,
404 gdim);
405 std::vector<geometry_type> xp_b(1 * gdim);
406 impl::mdspan_t<geometry_type, 2> xp(xp_b.data(), 1, gdim);
407
408 // Loop over points
409 std::ranges::fill(u, 0);
410 std::span<const value_type> _v = _x->array();
411
412 // Evaluate geometry basis at point (0, 0, 0) on the reference cell.
413 // Used in affine case.
414 std::array<std::size_t, 4> phi0_shape = cmap.tabulate_shape(1, 1);
415 std::vector<geometry_type> phi0_b(std::reduce(
416 phi0_shape.begin(), phi0_shape.end(), 1, std::multiplies{}));
417 impl::mdspan_t<const geometry_type, 4> phi0(phi0_b.data(), phi0_shape);
418 cmap.tabulate(1, std::vector<geometry_type>(tdim), {1, tdim}, phi0_b);
419 auto dphi0
420 = md::submdspan(phi0, std::pair(1, tdim + 1), 0, md::full_extent, 0);
421
422 // Data structure for evaluating geometry basis at specific points.
423 // Used in non-affine case.
424 std::array<std::size_t, 4> phi_shape = cmap.tabulate_shape(1, 1);
425 std::vector<geometry_type> phi_b(
426 std::reduce(phi_shape.begin(), phi_shape.end(), 1, std::multiplies{}));
427 impl::mdspan_t<const geometry_type, 4> phi(phi_b.data(), phi_shape);
428 auto dphi
429 = md::submdspan(phi, std::pair(1, tdim + 1), 0, md::full_extent, 0);
430
431 // Reference coordinates for each point
432 std::vector<geometry_type> Xb(xshape[0] * tdim);
433 impl::mdspan_t<geometry_type, 2> X(Xb.data(), xshape[0], tdim);
434
435 // Geometry data at each point
436 std::vector<geometry_type> J_b(xshape[0] * gdim * tdim);
437 impl::mdspan_t<geometry_type, 3> J(J_b.data(), xshape[0], gdim, tdim);
438 std::vector<geometry_type> K_b(xshape[0] * tdim * gdim);
439 impl::mdspan_t<geometry_type, 3> K(K_b.data(), xshape[0], tdim, gdim);
440 std::vector<geometry_type> detJ(xshape[0]);
441 std::vector<geometry_type> det_scratch(2 * gdim * tdim);
442
443 // Scratch space for pull-back of point coordinates for non-affine cells
444 std::vector<geometry_type> pull_back_scratch(
445 cmap.is_affine() ? 0 : cmap.pull_back_working_size(gdim));
446
447 // Prepare geometry data in each cell
448 for (auto cell_it = cells.begin(); cell_it != cells.end(); ++cell_it)
449 {
450 // Skip negative cell indices
451 if (*cell_it < 0)
452 continue;
453
454 // Get cell geometry (coordinate dofs)
455 auto x_dofs = md::submdspan(x_dofmap, *cell_it, md::full_extent);
456 assert(x_dofs.size() == num_dofs_g);
457 for (std::size_t i = 0; i < num_dofs_g; ++i)
458 {
459 const int pos = 3 * x_dofs[i];
460 for (std::size_t j = 0; j < gdim; ++j)
461 coord_dofs(i, j) = x_g[pos + j];
462 }
463
464 std::size_t p = std::ranges::distance(cells.begin(), cell_it);
465 for (std::size_t j = 0; j < gdim; ++j)
466 xp(0, j) = x[p * xshape[1] + j];
467
468 auto _J = md::submdspan(J, p, md::full_extent, md::full_extent);
469 auto _K = md::submdspan(K, p, md::full_extent, md::full_extent);
470
471 std::array<geometry_type, 3> Xpb{0, 0, 0};
472 md::mdspan<geometry_type, md::extents<std::size_t, 1, md::dynamic_extent>>
473 Xp(Xpb.data(), 1, tdim);
474
475 // Compute reference coordinates X, and J, detJ and K
476 if (cmap.is_affine())
477 {
479 _J);
481 std::array<geometry_type, 3> x0{0, 0, 0};
482 for (std::size_t i = 0; i < coord_dofs.extent(1); ++i)
483 x0[i] += coord_dofs(0, i);
485 detJ[p]
487 _J, det_scratch);
488 }
489 else
490 {
491 // Pull-back physical point xp to reference coordinate Xp
492 cmap.pull_back_nonaffine(Xp, xp, coord_dofs, pull_back_scratch, tol,
493 maxit);
494 cmap.tabulate(1, std::span(Xpb.data(), tdim), {1, tdim}, phi_b);
496 _J);
498 detJ[p]
500 _J, det_scratch);
501 }
502
503 for (std::size_t j = 0; j < X.extent(1); ++j)
504 X(p, j) = Xpb[j];
505 }
506
507 // Prepare basis function data structures
508 std::vector<geometry_type> basis_derivatives_reference_values_b(
509 1 * xshape[0] * space_dimension * reference_value_size);
510 impl::mdspan_t<const geometry_type, 4> basis_derivatives_reference_values(
511 basis_derivatives_reference_values_b.data(), 1, xshape[0],
512 space_dimension, reference_value_size);
513 std::vector<geometry_type> basis_values_b(space_dimension * value_size);
514 impl::mdspan_t<geometry_type, 2> basis_values(basis_values_b.data(),
515 space_dimension, value_size);
516
517 // Compute basis on reference element
518 element->tabulate(basis_derivatives_reference_values_b, Xb,
519 {X.extent(0), X.extent(1)}, 0);
520
521 using xu_t = impl::mdspan_t<geometry_type, 2>;
522 using xU_t = impl::mdspan_t<const geometry_type, 2>;
523 using xJ_t = impl::mdspan_t<const geometry_type, 2>;
524 using xK_t = impl::mdspan_t<const geometry_type, 2>;
525 auto push_forward_fn
526 = element->basix_element().template map_fn<xu_t, xU_t, xJ_t, xK_t>();
527
528 // Transformation function for basis function values
529 auto apply_dof_transformation
530 = element->template dof_transformation_fn<geometry_type>(
532
533 // Size of tensor for symmetric elements, unused in non-symmetric
534 // case, but placed outside the loop for pre-computation.
535 int matrix_size = 0;
536 if (element->symmetric())
537 {
538 while (matrix_size * matrix_size < (int)ushape[1])
539 ++matrix_size;
540 }
541
542 const std::size_t num_basis_values = space_dimension * reference_value_size;
543 for (auto cell_it = cells.begin(); cell_it != cells.end(); ++cell_it)
544 {
545 if (*cell_it < 0) // Skip negative cell indices
546 continue;
547
548 // Permute the reference basis function values to account for the
549 // cell's orientation
550 std::size_t p = std::ranges::distance(cells.begin(), cell_it);
551 if (apply_dof_transformation)
552 {
553 apply_dof_transformation(
554 std::span(basis_derivatives_reference_values_b.data()
555 + p * num_basis_values,
556 num_basis_values),
557 cell_info, *cell_it, reference_value_size);
558 }
559
560 {
561 auto _U = md::submdspan(basis_derivatives_reference_values, 0, p,
562 md::full_extent, md::full_extent);
563 auto _J = md::submdspan(J, p, md::full_extent, md::full_extent);
564 auto _K = md::submdspan(K, p, md::full_extent, md::full_extent);
565 push_forward_fn(basis_values, _U, _J, detJ[p], _K);
566 }
567
568 // Get degrees of freedom for current cell
569 std::span<const std::int32_t> dofs = dofmap->cell_dofs(*cell_it);
570 for (std::size_t i = 0; i < dofs.size(); ++i)
571 for (int k = 0; k < bs_dof; ++k)
572 coefficients[bs_dof * i + k] = _v[bs_dof * dofs[i] + k];
573
574 if (element->symmetric())
575 {
576 // Compute expansion
577 int row = 0;
578 int rowstart = 0;
579 for (int k = 0; k < bs_element; ++k)
580 {
581 if (k - rowstart > row)
582 {
583 row++;
584 rowstart = k;
585 }
586 for (std::size_t i = 0; i < space_dimension; ++i)
587 {
588 for (std::size_t j = 0; j < value_size; ++j)
589 {
590 u[p * ushape[1]
591 + (j * bs_element + row * matrix_size + k - rowstart)]
592 += coefficients[bs_element * i + k] * basis_values(i, j);
593 if (k - rowstart != row)
594 {
595 u[p * ushape[1]
596 + (j * bs_element + row + matrix_size * (k - rowstart))]
597 += coefficients[bs_element * i + k] * basis_values(i, j);
598 }
599 }
600 }
601 }
602 }
603 else
604 {
605 // Compute expansion
606 for (int k = 0; k < bs_element; ++k)
607 {
608 for (std::size_t i = 0; i < space_dimension; ++i)
609 {
610 for (std::size_t j = 0; j < value_size; ++j)
611 {
612 u[p * ushape[1] + (j * bs_element + k)]
613 += coefficients[bs_element * i + k] * basis_values(i, j);
614 }
615 }
616 }
617 }
618 }
619 }
620
622 std::string name;
623
624private:
625 // Function space
626 std::shared_ptr<const FunctionSpace<geometry_type>> _function_space;
627
628 // Vector of expansion coefficients (local)
629 std::shared_ptr<la::Vector<value_type>> _x;
630};
631
632} // namespace dolfinx::fem
Degree-of-freedom map representations and tools.
Definition CoordinateElement.h:39
static void compute_jacobian(const U &dphi, const V &cell_geometry, W &&J)
Definition CoordinateElement.h:141
void tabulate(int nd, std::span< const T > X, std::array< std::size_t, 2 > shape, std::span< T > basis) const
Evaluate basis values and derivatives at set of points.
Definition CoordinateElement.cpp:71
std::size_t pull_back_working_size(std::size_t gdim) const
Compute the working array size required for pull back.
Definition CoordinateElement.cpp:265
static void compute_jacobian_inverse(const U &J, V &&K)
Compute the inverse of the Jacobian.
Definition CoordinateElement.h:150
void pull_back_nonaffine(mdspan2_t< T > X, mdspan2_t< const T > x, mdspan2_t< const T > cell_geometry, std::span< T > working_array, double tol, int maxit) const
Compute reference coordinates X for physical coordinates x for a non-affine map.
Definition CoordinateElement.cpp:100
std::array< std::size_t, 4 > tabulate_shape(std::size_t nd, std::size_t num_points) const
Shape of array to fill when calling tabulate.
Definition CoordinateElement.cpp:64
int dim() const
The dimension of the coordinate element space.
Definition CoordinateElement.cpp:237
bool is_affine() const noexcept
Check if geometry map is affine.
Definition CoordinateElement.h:297
static double compute_jacobian_determinant(const U &J, std::span< typename U::value_type > w)
Compute the determinant of the Jacobian.
Definition CoordinateElement.h:167
static void pull_back_affine(U &&X, const V &K, std::array< T, 3 > x0, const W &x)
Compute reference coordinates X for physical coordinates x for an affine map. For the affine case,...
Definition CoordinateElement.h:223
This class represents a finite element function space defined by a mesh, a finite element,...
Definition FunctionSpace.h:36
Definition Function.h:44
U geometry_type
Geometry type of the Mesh that the Function is defined on.
Definition Function.h:50
void interpolate(const Function< value_type, geometry_type > &u, mesh::CellRange auto &&cells)
Interpolate a Function over a subset of cells.
Definition Function.h:268
Function(std::shared_ptr< const FunctionSpace< geometry_type > > V, std::string name="u")
Create function on given function space.
Definition Function.h:55
void interpolate(const Function< value_type, geometry_type > &u)
Interpolate a Function over all cells.
Definition Function.h:279
std::shared_ptr< const FunctionSpace< geometry_type > > function_space() const
Access the function space.
Definition Function.h:149
void interpolate(const std::function< std::pair< std::vector< value_type >, std::vector< std::size_t > >(md::mdspan< const geometry_type, md::extents< std::size_t, 3, md::dynamic_extent > >)> &f, mesh::CellRange auto &&cells)
Interpolate an expression f(x) over a set of cells.
Definition Function.h:164
void interpolate(const Function< value_type, geometry_type > &u0, mesh::CellRange auto &&cells0, mesh::CellRange auto &&cells1)
Interpolate a Function over a subset of cells.
Definition Function.h:256
void eval(std::span< const geometry_type > x, std::array< std::size_t, 2 > xshape, mesh::CellRange auto &&cells, std::span< value_type > u, std::array< std::size_t, 2 > ushape, double tol, int maxit) const
Evaluate the Function at points.
Definition Function.h:324
Function collapse() const
Collapse a subfunction (view into a Function) to a stand-alone Function.
Definition Function.h:121
void interpolate(const std::function< std::pair< std::vector< value_type >, std::vector< std::size_t > >(md::mdspan< const geometry_type, md::extents< std::size_t, 3, md::dynamic_extent > >)> &f)
Interpolate an expression f(x) on the whole domain.
Definition Function.h:226
Function sub(int i) const
Extract a sub-function (a view into the Function).
Definition Function.h:110
std::string name
Name.
Definition Function.h:622
std::shared_ptr< la::Vector< value_type > > x()
Underlying vector.
Definition Function.h:158
void interpolate(const Function< value_type, geometry_type > &u, mesh::CellRange auto &&cells, double tol, int maxit, const geometry::PointOwnershipData< U > &interpolation_data)
Interpolate a Function defined on a different mesh.
Definition Function.h:301
Function(std::shared_ptr< const FunctionSpace< geometry_type > > V, std::shared_ptr< la::Vector< value_type > > x, std::string name="u")
Create function on given function space with a given vector.
Definition Function.h:79
~Function()=default
Destructor.
Function(Function &&v)=default
Move constructor.
std::shared_ptr< const la::Vector< value_type > > x() const
Underlying vector (const version).
Definition Function.h:155
Function & operator=(Function &&v)=default
Move assignment.
T value_type
Definition Function.h:48
A vector that can be distributed across processes.
Definition Vector.h:53
Requirement on range of cell indices.
Definition Topology.h:35
Finite element method functionality.
Definition assemble_expression_impl.h:28
@ standard
Standard.
Definition FiniteElement.h:34
std::vector< T > interpolation_coords(const fem::FiniteElement< T > &element, const mesh::Geometry< T > &geometry, mesh::CellRange auto &&cells)
Compute the evaluation points in the physical space at which an expression should be computed to inte...
Definition interpolate.h:46
void interpolate(Function< T, U > &u1, mesh::CellRange auto &&cells1, const Expression< T, U > &e0, mesh::CellRange auto &&cells0)
Interpolate an Expression into a Function over a subset of cells.
Definition expression_evaluate.h:284
Linear algebra interface.
Definition dolfinx_la.h:7
Mesh data structures and algorithms on meshes.
Definition DofMap.h:32
Information on the ownership of points distributed across processes.
Definition utils.h:36