escript  Revision_
speckley/src/domainhelpers.h
Go to the documentation of this file.
1 
2 /*****************************************************************************
3 *
4 * Copyright (c) 2003-2016 by The University of Queensland
5 * http://www.uq.edu.au
6 *
7 * Primary Business: Queensland, Australia
8 * Licensed under the Apache License, version 2.0
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
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 _SPECKLEY_DOMAINHELPERS_H_
17 #define _SPECKLEY_DOMAINHELPERS_H_
18 
19 #include <speckley/Speckley.h>
20 #include <escript/Data.h>
21 
22 namespace speckley {
23 
24 typedef std::map<std::string, escript::Data> DataMap;
25 
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 
39 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 
49 void factorise(std::vector<int>& factors, int product);
50 
51 #ifdef ESYS_HAVE_BOOST_IO
52 
55 std::vector<char> unzip(const std::vector<char>& compressed);
56 #endif // ESYS_HAVE_BOOST_IO
57 
58 } //namespace speckley
59 
60 #endif // _SPECKLEY_DOMAINHELPERS_H_
61 
escript::Data unpackData(std::string target, std::map< std::string, escript::Data > mapping)
Definition: AbstractAssembler.cpp:20
Definition: AbstractAssembler.cpp:18
std::map< std::string, escript::Data > DataMap
Definition: speckley/src/domainhelpers.h:24
bool isNotEmpty(const std::string target, const DataMap &mapping)
Definition: speckley/src/domainhelpers.h:39
void factorise(std::vector< int > &factors, int product)
Definition: speckley/src/domainhelpers.cpp:29
Data represents a collection of datapoints.
Definition: Data.h:63