The ChainCon Software (Release 0.03)
setfilter.h
Go to the documentation of this file.
1 /////////////////////////////////////////////////////////////////////////////
2 ///
3 /// \file
4 ///
5 /// A function that creates a filter from a set of cells
6 /// of different dimensions.
7 ///
8 /////////////////////////////////////////////////////////////////////////////
9 
10 // Copyright (C) 2009-2016 by Pawel Pilarczyk.
11 //
12 // This file is part of my research software package. This is free software:
13 // you can redistribute it and/or modify it under the terms of the GNU
14 // General Public License as published by the Free Software Foundation,
15 // either version 3 of the License, or (at your option) any later version.
16 //
17 // This software is distributed in the hope that it will be useful,
18 // but WITHOUT ANY WARRANTY; without even the implied warranty of
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 // GNU General Public License for more details.
21 //
22 // You should have received a copy of the GNU General Public License
23 // along with this software; see the file "license.txt". If not,
24 // please, see <http://www.gnu.org/licenses/>.
25 
26 // Started on March 24, 2009. Last revision: August 21, 2013.
27 
28 
29 #ifndef _CHAINCON_SETFILTER_H_
30 #define _CHAINCON_SETFILTER_H_
31 
32 
33 // include relevant local header files
34 
35 // include selected header files from the CHomP library
36 #include "chomp/system/config.h"
37 
38 // include some standard C++ header files
39 
40 
41 // --------------------------------------------------
42 // ----------------- set to filter ------------------
43 // --------------------------------------------------
44 
45 /// Transforms a collection of cells to a filter by adding them
46 /// in the order of decreasing dimension.
47 /// The maximal dimension of cells of interest must be provided.
48 template <class SetT, class FilterT>
49 inline void set2filter (const SetT &set, FilterT &filter, int maxDim)
50 {
51  using chomp::homology::sbug;
52 
53  int_t size = set. size ();
54  for (int dim = maxDim; dim >= 0; -- dim)
55  {
56  for (int_t i = 0; i < size; ++ i)
57  {
58  if (set [i]. dim () == dim)
59  filter. add (set [i]);
60  }
61  }
62 
63  return;
64 } /* set2filter */
65 
66 
67 #endif // _CHAINCON_SETFILTER_H_
68 
void set2filter(const SetT &set, FilterT &filter, int maxDim)
Transforms a collection of cells to a filter by adding them in the order of decreasing dimension...
Definition: setfilter.h:49