Loading...
Searching...
No Matches
indexing.h
// Copyright (c) 2020 Chris Richardson
// FEniCS Project
// SPDX-License-Identifier: MIT
#pragma once
namespace basix::indexing
{
constexpr int idx(int p) { return p; }
constexpr int idx(int p, int q) { return (p + q + 1) * (p + q) / 2 + q; }
constexpr int idx(int p, int q, int r)
{
return (p + q + r) * (p + q + r + 1) * (p + q + r + 2) / 6
+ (q + r) * (q + r + 1) / 2 + r;
}
} // namespace basix::indexing
basix::indexing
Indexing.
Definition indexing.h:9
basix::indexing::idx
constexpr int idx(int p)
Compute trivial indexing in a 1D array (for completeness).
Definition indexing.h:13