This file is indexed.

/usr/include/dune/grid/io/file/amirameshwriter.hh is in libdune-grid-dev 2.2.1-2.

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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
#ifndef DUNE_AMIRAMESH_WRITER_HH
#define DUNE_AMIRAMESH_WRITER_HH

#include <string>

#include <dune/common/array.hh>

#if HAVE_AMIRAMESH
#include <amiramesh/AmiraMesh.h>
#endif

namespace Dune {
   
    /** @ingroup AmiraMesh
     * \brief Provides file writing facilities in the AmiraMesh format.
     *
     */
    template<class GridView>
    class AmiraMeshWriter {

        enum {dim = GridView::dimension};

    public:

        /** \brief Add a grid view to the file
            \param gridView GridView to be written
            \param splitAll If this is set every element of the grid will be split into triangles/tetrahedra.
            Amira doesn't support 2d quad grids so if this is not set for a quadrilateral grid in 2d the file
            won't be readable by standard Amira. See the refinement documentation to see which types can be split up yet.
            If the grid has been split up and contains other types than triangles/tetrahedra you also have to set
            GridSplitUp when calling the functions "addVertexData" and "writeBlockVector" to make the data consistent with the grid! 
        */
        void addGrid(const GridView& gridView, bool splitAll=false);

        /** \brief Add level grid 
            \param grid Grid to be written
            \param level Level of the level grid that is to be written
            \param splitAll If this is set every element of the grid will be split into triangles/tetrahedra.
            Amira doesn't support 2d quad grids so if this is not set for a quadrilateral grid in 2d the file
            won't be readable by standard Amira. See the refinement documentation to see which types can be split up yet.
            If the grid has been split up and contains other types than triangles/tetrahedra you also have to set
            GridSplitUp when calling the functions "addVertexData" and "writeBlockVector" to make the data consistent with the grid!
        */
        template <class GridType2>
        void addLevelGrid(const GridType2& grid, int level, bool splitAll=false);

        /** \brief Add leaf grid 
            \param grid Grid to be written
            \param splitAll If this is set every element of the grid will be split into triangles/tetrahedra.
            Amira doesn't support 2d quad grids so if this is not set for a quadrilateral grid in 2d the file
            won't be readable by standard Amira. See the refinement documentation to see which types can be split up yet.
            If the grid has been split up and contains other types than triangles/tetrahedra you also have to set
            GridSplitUp when calling the functions "addVertexData" and "writeBlockVector" to make the data consistent with the grid!
        */
        template <class GridType2>
        void addLeafGrid(const GridType2& grid, bool splitAll=false);

        /** \brief Add cell data
            \param data An ISTL compliant vector type
            \param gridView Grid view that the data belongs to
            \param GridSplitUp If the grid has been split up into triangles/tetrahedra you have to set GridSplitUp to make the data
            consistent with the grid
        */
        template <class DataContainer>
        void addCellData(const DataContainer& data, const GridView& gridView, bool GridSplitUp=false);

        /** \brief Add vertex data 
            \param data An ISTL compliant vector type
            \param gridView Grid view that the data belongs to
            \param GridSplitUp If the grid has been split up into triangles/tetrahedra you have to set GridSplitUp to make the data
            consistent with the grid
        */
        template <class DataContainer>
        void addVertexData(const DataContainer& data, const GridView& gridView, bool GridSplitUp=false);

        /** \brief Write AmiraMesh object to disk 
            \param filename Name of the file to write to
            \param ascii Set this if you want an ascii AmiraMesh file
        */
        void write(const std::string& filename, bool ascii=false) const;

        /** \brief Write data on a uniform grid into an AmiraMesh file
        */
        template <class DataContainer>
        void addUniformData(const GridView& gridView,
                            const array<unsigned int, dim>& n,
                            const DataContainer& data);
        
        /** \brief Write a 2d grid in a 3d world
         * 
         * Technically, the format written is 'HyperSurface', not 'AmiraMesh'.
         * AmiraMesh doesn't support 2d grids in a 3d world.  Hypersurface is the
         * native Amira format for such grids.  Historically, it is the ancestor of
         * the AmiraMesh format, and syntactically it is fairly similar.
         * 
         * Currently, quadrilaterals will get split into triangles.
         * 
         * \note This code is experimental and may change withour prior warning
         */
        static void writeSurfaceGrid(const GridView& gridView,
                                     const std::string& filename);

    protected:
        
#if HAVE_AMIRAMESH  // better: use a pointer here and forward-declare AmiraMesh
        AmiraMesh amiramesh_;
#endif
    };

    /** @ingroup AmiraMesh
     * \brief Provides file writing facilities in the AmiraMesh format for level grids.
     *
     */
    template<class GridType>
    class LevelAmiraMeshWriter 
        : public AmiraMeshWriter<typename GridType::LevelGridView>
    {

    public:

        /** \brief Default constructor */
        LevelAmiraMeshWriter() {}

        /** \brief Constructor which initializes the AmiraMesh object with a given level grid */
        LevelAmiraMeshWriter(const GridType& grid, int level) {
            this->addGrid(grid.levelView(level));
        }

        /** \brief Write a grid in AmiraMesh format
         *
         * @param grid The grid objects that is to be written
         * @param filename The filename
         * @param level The level to be written
         */
        static void writeGrid(const GridType& grid, 
                              const std::string& filename,
                              int level) {
            LevelAmiraMeshWriter amiramesh(grid, level);
            amiramesh.write(filename);
        }

        /** \brief Writes an ISTL block vector in AmiraMesh format 
            @param grid The grid objects that the vector lives on
            @param f The vector to be written.  Has to comply with the ISTL conventions
            @param filename The filename
            @param level The level of the grid that the vector lives on
            @param GridSplitUp If the grid has been split up into triangles/tetrahedra you have to set this parameter to 
            make the data consistent with the grid
        */
        template <class VectorType>
        static void writeBlockVector(const GridType& grid,
                                     const VectorType& f,
                                     const std::string& filename,
                                     int level,
                                     bool GridSplitUp=false) {
        	LevelAmiraMeshWriter amiramesh;
            if (f.size()==grid.size(level,GridType::dimension))
            	amiramesh.addVertexData(f, grid.levelView(level),GridSplitUp);
            else
            	amiramesh.addCellData(f, grid.levelView(level),GridSplitUp);
            amiramesh.write(filename);
        }

    };

    /** @ingroup AmiraMesh
     * \brief Provides file writing facilities in the AmiraMesh format for leaf grids.
     *
     */
    template<class GridType>
    class LeafAmiraMeshWriter 
        : public AmiraMeshWriter<typename GridType::LeafGridView>
    {

    public:

        /** \brief Default constructor */
        LeafAmiraMeshWriter() {}

        /** \brief Constructor which initializes the AmiraMesh object with a given leaf grid */
        LeafAmiraMeshWriter(const GridType& grid) {
            this->addLeafGrid(grid);
        }

        /** \brief Write a grid in AmiraMesh format
         *
         * @param grid The grid objects that is to be written
         * @param filename The filename
         */
        static void writeGrid(const GridType& grid, 
                              const std::string& filename) {
            LeafAmiraMeshWriter amiramesh(grid);
            amiramesh.write(filename);
        }

        /** \brief Writes an ISTL block vector in AmiraMesh format 
            @param grid The grid objects that the vector lives on
            @param f The vector to be written.  Has to comply with the ISTL conventions
            @param filename The filename
            @param GridSplitUp set true to split up the grid into triangles/tetrahedra
        */
        template <class VectorType>
        static void writeBlockVector(const GridType& grid,
                                     const VectorType& f,
                                     const std::string& filename,
                                     bool GridSplitUp = false) {
        	LeafAmiraMeshWriter amiramesh;
            if (f.size()==grid.size(GridType::dimension))
            	amiramesh.addVertexData(f, grid.leafView(),GridSplitUp);
            else
            	amiramesh.addCellData(f, grid.leafView(),GridSplitUp);
            
            amiramesh.write(filename);
        }

    };

}

// implementation
#if HAVE_AMIRAMESH
#include "amiramesh/amirameshwriter.cc"
#endif

#endif