Loading [MathJax]/extensions/tex2jax.js
ug4
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
file_io.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2009-2015: G-CSC, Goethe University Frankfurt
3 * Author: Sebastian Reiter
4 *
5 * This file is part of UG4.
6 *
7 * UG4 is free software: you can redistribute it and/or modify it under the
8 * terms of the GNU Lesser General Public License version 3 (as published by the
9 * Free Software Foundation) with the following additional attribution
10 * requirements (according to LGPL/GPL v3 §7):
11 *
12 * (1) The following notice must be displayed in the Appropriate Legal Notices
13 * of covered and combined works: "Based on UG4 (www.ug4.org/license)".
14 *
15 * (2) The following notice must be displayed at a prominent place in the
16 * terminal output of covered works: "Based on UG4 (www.ug4.org/license)".
17 *
18 * (3) The following bibliography is recommended for citation and must be
19 * preserved in all covered files:
20 * "Reiter, S., Vogel, A., Heppner, I., Rupp, M., and Wittum, G. A massively
21 * parallel geometric multigrid solver on hierarchically distributed grids.
22 * Computing and visualization in science 16, 4 (2013), 151-164"
23 * "Vogel, A., Reiter, S., Rupp, M., Nägel, A., and Wittum, G. UG4 -- a novel
24 * flexible software system for simulating pde based models on high performance
25 * computers. Computing and visualization in science 16, 4 (2013), 165-179"
26 *
27 * This program is distributed in the hope that it will be useful,
28 * but WITHOUT ANY WARRANTY; without even the implied warranty of
29 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 * GNU Lesser General Public License for more details.
31 */
32
33#ifndef __H__LIB_GRID__FILE_IO__
34#define __H__LIB_GRID__FILE_IO__
35
36#include "common/types.h"
37#include "common/ug_config.h"
38#include "common/error.h"
42
43namespace ug
44{
45
46// predeclaration of surface view (declared in lib_grid/tools/surface_view.h)
47class Grid;
48class MultiGrid;
49class SurfaceView;
50class ISubsetHandler;
51
54
72template <class TAPos>
74bool LoadGridFromFile(Grid& grid, SPProjectionHandler& ph, size_t& num_ph, ISubsetHandler& sh, std::vector<std::string> additionalSHNames,
75 std::vector<SmartPtr<ISubsetHandler>> ash, const char* filename, TAPos& aPos, int procId = -1);
76
77template <class TAPos>
79bool LoadGridFromFile(Grid& grid, ISubsetHandler& sh, const char* filename, TAPos& aPos, int procId = -1);
80
81template <class TAPos>
83bool LoadGridFromFile(Grid& grid, const char* filename, TAPos& aPos, int procId = -1);
88
102UG_API
103bool LoadGridFromFile(Grid& grid, ISubsetHandler& sh, const char* filename, int procId = -1);
104
105UG_API
106bool LoadGridFromFile(Grid& grid, const char* filename, int procId = -1);
112
118template <class TAPos>
119UG_API
120bool SaveGridToFile(Grid& grid, ISubsetHandler& sh,
121 const char* filename, TAPos& aPos);
122
123template <class TAPos>
124UG_API
125bool SaveGridToFile(Grid& grid, const char* filename, TAPos& aPos);
130
131UG_API
132bool SaveGridToFile(Grid& grid, ISubsetHandler& sh, const char* filename);
133
134UG_API
135bool SaveGridToFile(Grid& grid, const char* filename);
140
142 const char* filename, number offset);
143
145
146bool SaveGridHierarchyTransformed(MultiGrid& mg, const char* filename,
147 number offset);
148
150
151bool SaveParallelGridLayout(MultiGrid& mg, const char* filename,
152 number offset = 0.1);
153
154
156
158 const char* filename, number offset = 0.1);
159
160
163
167template <class TAPos>
168void CopyGridLevel(MultiGrid& srcMG, Grid& destGrid,
169 ISubsetHandler& srcSH, ISubsetHandler& destSH,
170 int lvl, TAPos aPos);
171
172
175
185template <class TAPos>
186void CopyGrid
187(
188 Grid& srcGrid,
189 Grid& destGrid,
190 ISubsetHandler& srcSH,
191 ISubsetHandler& destSH,
192 TAPos aPos
193);
194
196
205template <typename TAPos>
206void MergeGrids
207(
208 Grid& mrgGrid,
209 Grid& grid,
210 ISubsetHandler& mrgSh,
211 ISubsetHandler& sh,
212 TAPos aPos,
213 bool joinSubsets
214);
215
217
221template <class TAPos>
222bool SaveGridLevel(MultiGrid& srcMG, ISubsetHandler& srcSH, int lvl,
223 const char* filename, TAPos aPos);
224
225
227
231bool SaveGridLevelToFile(MultiGrid& srcMG, ISubsetHandler& srcSH, int lvl,
232 const char* filename);
233
235template<class TElem>
236void CopyGridElements(Grid& srcGrid, Grid& destGrid,
237 ISubsetHandler& srcSH, ISubsetHandler& destSH,
238 Attachment<Vertex*>& aNewVrt);
240}
241
243#include "file_io_impl.h"
244
245#endif
Definition smart_pointer.h:108
A generic specialization of IAttachment.
Definition attachment_pipe.h:263
Manages the elements of a grid and their interconnection.
Definition grid.h:132
Definition subset_handler_interface.h:223
Definition multi_grid.h:72
Represents the surface view of a multi-grid hierarchy.
Definition surface_view.h:61
#define UG_API
Definition ug_config.h:65
double number
Definition types.h:124
the ug namespace
bool SaveSurfaceViewTransformed(MultiGrid &mg, const SurfaceView &sv, const char *filename, number offset)
Saves a grid and assigns elements to subsets based on their surface-view-state.
Definition file_io.cpp:692
bool SaveGridHierarchyTransformed(MultiGrid &mg, ISubsetHandler &sh, const char *filename, number offset)
Saves a grid hierarchy by offsetting levels along the z-axis.
Definition file_io.cpp:507
bool SaveGridToFile(Grid &grid, ISubsetHandler &sh, const char *filename, TAPos &aPos)
Saves a grid to a file. Position data is read from the specified attachment.
Definition file_io.cpp:468
bool SaveParallelGridLayout(MultiGrid &mg, const char *filename, number offset)
Saves the grid-layout of parallel multi-grids.
Definition file_io.cpp:625
bool SaveGridLevelToFile(MultiGrid &srcMG, ISubsetHandler &srcSH, int lvl, const char *filename)
Saves a grid level to a file.
Definition file_io.cpp:932
void MergeGrids(Grid &mrgGrid, Grid &grid, ISubsetHandler &mrgSH, ISubsetHandler &sh, TAPos aPos, bool joinSubsets)
Merges to grids into one grid.
Definition file_io.cpp:852
void CopyGridLevel(MultiGrid &srcMG, Grid &destGrid, ISubsetHandler &srcSH, ISubsetHandler &destSH, int lvl, TAPos aPos)
Copies a grid level to a separate grid.
Definition file_io.cpp:767
void CopyGrid(Grid &srcGrid, Grid &destGrid, ISubsetHandler &srcSH, ISubsetHandler &destSH, TAPos aPos)
Copies a grid to a separate grid.
Definition file_io.cpp:802
bool SaveGridLevel(MultiGrid &srcMG, ISubsetHandler &srcSH, int lvl, const char *filename, TAPos aPos)
Saves a grid level to a file.
Definition file_io.cpp:836
void CopyGridElements(Grid &srcGrid, Grid &destGrid, ISubsetHandler &srcSH, ISubsetHandler &destSH, Attachment< Vertex * > &aNewVrt)
Copy grid elements of type TElem from srcGrid to destGrid.
Definition file_io_impl.h:43
bool LoadGridFromFile(Grid &grid, SPProjectionHandler &ph, size_t &num_ph, ISubsetHandler &sh, vector< string > additionalSHNames, vector< SmartPtr< ISubsetHandler > > ash, const char *filename, TAPos &aPos, int procId)
Definition file_io.cpp:315