/usr/include/dune/grid/utility/vertexorderfactory.hh is in libdune-grid-dev 2.3.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 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 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#ifndef DUNE_GRID_UTILITY_VERTEXORDERFACTORY_HH
#define DUNE_GRID_UTILITY_VERTEXORDERFACTORY_HH
#include <algorithm>
#include <cstddef>
#include <functional>
#include <vector>
#include <dune/geometry/referenceelements.hh>
#include <dune/geometry/generalvertexorder.hh>
namespace Dune {
//! Factory for GeneralVertexOrder objects using an IdSet
/**
* \tparam IdSet Type used to get the ids of the vertices.
* \tparam Index Type of the indices provided by the vertex ordering
* object. Must be integral, may be non-negative.
*
* \warning The Interface of the VertexOrder stuff is subject to change. It
* is currently needed to use some global-valued finite elements
* from dune-localfunctions.
*
* \sa GeneralVertexOrder, reduceOrder()
*/
template<class IdSet, class Index = std::size_t>
class VertexOrderByIdFactory {
const IdSet& idset;
public:
//! type of vertex order object may depend on the dimension of the element
template<std::size_t dim>
struct VertexOrder {
//! type of vertex order object
typedef GeneralVertexOrder<dim, Index> type;
};
//! construct a factory object
/**
* \tparam idset_ IdSet to use to extract the vertex ids.
*
* This factory object stores a reference to the IdSet object. The
* factory object's value will become singular when the stored reference
* becomes invalid. The only valid operation on a factory with singular
* value is destruction, all other operations will result in undefined
* behaviour.
*/
VertexOrderByIdFactory(const IdSet &idset_) : idset(idset_) { }
//! construct a vertex ordering object
/**
* \param e Grid element to create the vertex ordering object for.
*
* The returned object will remain valid even after the factory has become
* singular or has been destroyed.
*/
template<typename Element>
typename VertexOrder<Element::mydimension>::type
make(const Element &e) const {
typedef ReferenceElements<
typename Element::ctype,
Element::mydimension
> RefElems;
std::size_t size =
RefElems::general(e.type()).size(Element::mydimension);
std::vector<typename IdSet::IdType> ids(size);
for(std::size_t i = 0; i < size; ++i)
ids[i] = idset.subId(e, i, Element::mydimension);
return GeneralVertexOrder<Element::mydimension, Index>
(e.type(), ids.begin(), ids.end());
}
};
} // namespace Dune
#endif // DUNE_GRID_UTILITY_VERTEXORDERFACTORY_HH
|