Loading [MathJax]/extensions/tex2jax.js
ug4
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
file_io_impl.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2009-2019: G-CSC, Goethe University Frankfurt
3 * Author: Stephan Grein
4 * Creation date: 2019-07-05
5 *
6 * This file is part of UG4.
7 *
8 * UG4 is free software: you can redistribute it and/or modify it under the
9 * terms of the GNU Lesser General Public License version 3 (as published by the
10 * Free Software Foundation) with the following additional attribution
11 * requirements (according to LGPL/GPL v3 §7):
12 *
13 * (1) The following notice must be displayed in the Appropriate Legal Notices
14 * of covered and combined works: "Based on UG4 (www.ug4.org/license)".
15 *
16 * (2) The following notice must be displayed at a prominent place in the
17 * terminal output of covered works: "Based on UG4 (www.ug4.org/license)".
18 *
19 * (3) The following bibliography is recommended for citation and must be
20 * preserved in all covered files:
21 * "Reiter, S., Vogel, A., Heppner, I., Rupp, M., and Wittum, G. A massively
22 * parallel geometric multigrid solver on hierarchically distributed grids.
23 * Computing and visualization in science 16, 4 (2013), 151-164"
24 * "Vogel, A., Reiter, S., Rupp, M., Nägel, A., and Wittum, G. UG4 -- a novel
25 * flexible software system for simulating pde based models on high performance
26 * computers. Computing and visualization in science 16, 4 (2013), 165-179"
27 *
28 * This program is distributed in the hope that it will be useful,
29 * but WITHOUT ANY WARRANTY; without even the implied warranty of
30 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
31 * GNU Lesser General Public License for more details.
32 */
33
34#ifndef __H__LIB_GRID__FILE_IO_IMPL__
35#define __H__LIB_GRID__FILE_IO_IMPL__
36
37#include "file_io.h"
40
41namespace ug {
42 template<class TElem>
43 void CopyGridElements(Grid& srcGrid, Grid& destGrid,
44 ISubsetHandler& srcSH, ISubsetHandler& destSH,
45 Attachment<Vertex*>& aNewVrt)
46 {
47 Grid::VertexAttachmentAccessor<Attachment<Vertex*> > aaNewVrt(srcGrid, aNewVrt);
50
51 typedef typename Grid::traits<TElem>::iterator iter_t;
52
53 for (iter_t eIter = goc.begin<TElem>(); eIter != goc.end<TElem>(); ++eIter)
54 {
55 TElem* e = *eIter;
56 vrts.resize(e->num_vertices());
57
58 for (size_t iv = 0; iv < e->num_vertices(); ++iv)
59 {
60 vrts.set_vertex(iv, aaNewVrt[e->vertex(iv)]);
61 }
62
63 TElem* ne = *destGrid.create_by_cloning(e, vrts);
64 destSH.assign_subset(ne, srcSH.get_subset_index(e));
65 }
66 }
67}
68
69#endif /* __H__LIB_GRID__FILE_IO_IMPL__ */
A generic specialization of IAttachment.
Definition attachment_pipe.h:263
this class can be used if one wants to create a custom element from a set of vertices.
Definition grid_base_objects.h:336
void set_vertex(size_t index, Vertex *vrt)
Definition grid_base_objects.h:350
void resize(size_t newSize)
Definition grid_base_objects.h:347
Manages the elements of a grid and their interconnection.
Definition grid.h:132
VertexIterator create_by_cloning(Vertex *pCloneMe, GridObject *pParent=NULL)
this method creates a new vertex, which has the same type as pCloneMe.
Definition grid.cpp:419
virtual GridObjectCollection get_grid_objects()
returns the the GridObjectCollection of the grid:
Definition grid.cpp:527
a helper class that holds a collection of possibly unconnected geometric-objects.
Definition grid_object_collection.h:96
geometry_traits< TGeomObj >::iterator begin(size_t level=0)
Definition grid_object_collection_impl.hpp:95
geometry_traits< TGeomObj >::iterator end(size_t level=0)
Definition grid_object_collection_impl.hpp:106
Definition subset_handler_interface.h:223
void assign_subset(TIterator iterBegin, TIterator iterEnd, int subsetIndex)
Definition subset_handler_interface_impl.hpp:170
int get_subset_index(GridObject *elem) const
Definition subset_handler_interface.cpp:560
the ug namespace
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
geometry_traits< TElem >::iterator iterator
Definition grid.h:143