Line data Source code
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"
38 : #include "lib_grid/algorithms/attachment_util.h"
39 : #include "lib_grid/algorithms/subset_util.h"
40 :
41 : namespace ug {
42 : template<class TElem>
43 0 : void CopyGridElements(Grid& srcGrid, Grid& destGrid,
44 : ISubsetHandler& srcSH, ISubsetHandler& destSH,
45 : Attachment<Vertex*>& aNewVrt)
46 : {
47 : Grid::VertexAttachmentAccessor<Attachment<Vertex*> > aaNewVrt(srcGrid, aNewVrt);
48 0 : GridObjectCollection goc = srcGrid.get_grid_objects();
49 : CustomVertexGroup vrts;
50 :
51 : typedef typename Grid::traits<TElem>::iterator iter_t;
52 :
53 0 : for (iter_t eIter = goc.begin<TElem>(); eIter != goc.end<TElem>(); ++eIter)
54 : {
55 : TElem* e = *eIter;
56 0 : vrts.resize(e->num_vertices());
57 :
58 0 : for (size_t iv = 0; iv < e->num_vertices(); ++iv)
59 : {
60 0 : vrts.set_vertex(iv, aaNewVrt[e->vertex(iv)]);
61 : }
62 :
63 0 : TElem* ne = *destGrid.create_by_cloning(e, vrts);
64 0 : destSH.assign_subset(ne, srcSH.get_subset_index(e));
65 : }
66 0 : }
67 : }
68 :
69 : #endif /* __H__LIB_GRID__FILE_IO_IMPL__ */
|