/usr/include/deal.II/algorithms/named_selection.h is in libdeal.ii-dev 8.4.2-2+b1.
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 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | // ---------------------------------------------------------------------
//
// Copyright (C) 2000 - 2016 by the deal.II authors
//
// This file is part of the deal.II library.
//
// The deal.II library is free software; you can use it, redistribute
// it, and/or modify it under the terms of the GNU Lesser General
// Public License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
// The full text of the license can be found in the file LICENSE at
// the top level of the deal.II distribution.
//
// ---------------------------------------------------------------------
#ifndef dealii__named_selection_h
#define dealii__named_selection_h
#include <deal.II/base/config.h>
#include <deal.II/algorithms/any_data.h>
#include <string>
DEAL_II_NAMESPACE_OPEN
/**
* Select data from AnyData corresponding to the attached name.
*
* Given a list of names to search for (provided by add()), objects of this
* class provide an index list of the selected data.
*
* @author Guido Kanschat, 2009
*/
class NamedSelection
{
public:
/**
* Add a new name to be searched for in @p data supplied in initialize().
*
* @note Names will be added to the end of the current list.
*/
void add (const std::string &name);
/**
* Create the index vector pointing into the AnyData object.
*/
void initialize(const AnyData &data);
/**
* The number of names in this object. This function may be used whether
* initialize() was called before or not.
*/
unsigned int size() const;
/**
* Return the corresponding index in the AnyData object supplied to the last
* initialize(). It is an error if initialize() has not been called before.
*
* Indices are in the same order as the calls to add().
*/
unsigned int operator() (unsigned int i) const;
private:
/**
* The selected names.
*/
std::vector<std::string> names;
/**
* The index map generated by initialize() and accessed by operator().
*/
std::vector<unsigned int> indices;
};
inline
unsigned int
NamedSelection::size() const
{
return names.size();
}
inline
void
NamedSelection::add(const std::string &s)
{
names.push_back(s);
}
inline
unsigned int
NamedSelection::operator() (unsigned int i) const
{
Assert (indices.size() == names.size(), ExcNotInitialized());
AssertIndexRange(i, size());
return indices[i];
}
DEAL_II_NAMESPACE_CLOSE
#endif
|