/[escript]/trunk/ripley/src/domainhelpers.h
ViewVC logotype

Annotation of /trunk/ripley/src/domainhelpers.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 6651 - (hide annotations)
Wed Feb 7 02:12:08 2018 UTC (14 months, 2 weeks ago) by jfenwick
File MIME type: text/plain
File size: 2180 byte(s)
Make everyone sad by touching all the files

Copyright dates update

1 sshaw 4712
2 caltinay 5114 /*****************************************************************************
3     *
4 jfenwick 6651 * Copyright (c) 2003-2018 by The University of Queensland
5 caltinay 5114 * http://www.uq.edu.au
6     *
7     * Primary Business: Queensland, Australia
8 jfenwick 6112 * Licensed under the Apache License, version 2.0
9     * http://www.apache.org/licenses/LICENSE-2.0
10 caltinay 5114 *
11     * Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12     * Development 2012-2013 by School of Earth Sciences
13     * Development from 2014 by Centre for Geoscience Computing (GeoComp)
14     *
15     *****************************************************************************/
16     #ifndef _RIPLEY_DOMAINHELPERS_H_
17     #define _RIPLEY_DOMAINHELPERS_H_
18    
19 sshaw 4722 #include <ripley/Ripley.h>
20 sshaw 4760 #include <escript/Data.h>
21 sshaw 4712
22 caltinay 5114 namespace ripley {
23    
24     typedef std::map<std::string, escript::Data> DataMap;
25    
26     /// returns the data associated with the string key or an empty data object
27     /// if the map does not contain the given key
28     inline const escript::Data unpackData(const std::string target,
29     const DataMap& mapping)
30     {
31     DataMap::const_iterator i = mapping.find(target);
32     return (i == mapping.end() ? escript::Data() : i->second);
33     }
34    
35 sshaw 4738 /**
36 caltinay 5114 returns true if the given string is in the mapping AND the resulting
37     coefficient is not empty
38 sshaw 4738 */
39 caltinay 5114 inline bool isNotEmpty(const std::string target, const DataMap& mapping)
40     {
41     DataMap::const_iterator i = mapping.find(target);
42     return i != mapping.end() && !i->second.isEmpty();
43     }
44 sshaw 4718
45 sshaw 4738 /**
46     sets va[a] = b and vb[b] = a, used in constructing CSC and CSR matrix
47     formats simultaneously
48     */
49 caltinay 5114 inline void doublyLink(std::vector<ripley::IndexVector>& va,
50     std::vector<ripley::IndexVector>& vb, int a, int b)
51     {
52     va[a].push_back(b);
53     vb[b].push_back(a);
54     }
55 sshaw 4738
56 sshaw 4760 /**
57 caltinay 5114 factorises 'product' and inserts the factors into the vector 'factors'
58     in order of smallest to largest
59 sshaw 4760 */
60 caltinay 5114 void factorise(std::vector<int>& factors, int product);
61 sshaw 4760
62 caltinay 6141 #ifdef ESYS_HAVE_BOOST_IO
63 sshaw 4738 /**
64 caltinay 5114 converts the given gzip compressed char vector into an uncompressed form
65 sshaw 4738 */
66 caltinay 5114 std::vector<char> unzip(const std::vector<char>& compressed);
67 caltinay 6141 #endif // ESYS_HAVE_BOOST_IO
68 caltinay 5114
69     } // namespace ripley
70    
71     #endif // _RIPLEY_DOMAINHELPERS_H_
72    

  ViewVC Help
Powered by ViewVC 1.1.26