escript  Revision_
ripley/src/domainhelpers.h
Go to the documentation of this file.
1 
2 /*****************************************************************************
3 *
4 * Copyright (c) 2003-2020 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-2017 by Centre for Geoscience Computing (GeoComp)
14 * Development from 2019 by School of Earth and Environmental Sciences
15 **
16 *****************************************************************************/
17 #ifndef _RIPLEY_DOMAINHELPERS_H_
18 #define _RIPLEY_DOMAINHELPERS_H_
19 
20 #include <ripley/Ripley.h>
21 #include <escript/Data.h>
22 
23 namespace ripley {
24 
25 typedef std::map<std::string, escript::Data> DataMap;
26 
29 inline const escript::Data unpackData(const std::string target,
30  const DataMap& mapping)
31 {
32  DataMap::const_iterator i = mapping.find(target);
33  return (i == mapping.end() ? escript::Data() : i->second);
34 }
35 
40 inline bool isNotEmpty(const std::string target, const DataMap& mapping)
41 {
42  DataMap::const_iterator i = mapping.find(target);
43  return i != mapping.end() && !i->second.isEmpty();
44 }
45 
50 inline void doublyLink(std::vector<ripley::IndexVector>& va,
51  std::vector<ripley::IndexVector>& vb, int a, int b)
52 {
53  va[a].push_back(b);
54  vb[b].push_back(a);
55 }
56 
61 void factorise(std::vector<int>& factors, int product);
62 
63 #ifdef ESYS_HAVE_BOOST_IO
64 
67 std::vector<char> unzip(const std::vector<char>& compressed);
68 #endif // ESYS_HAVE_BOOST_IO
69 
70 } // namespace ripley
71 
72 #endif // _RIPLEY_DOMAINHELPERS_H_
73 
ripley::isNotEmpty
bool isNotEmpty(const std::string target, const DataMap &mapping)
Definition: ripley/src/domainhelpers.h:52
ripley
Definition: ripley/src/AbstractAssembler.h:25
ripley::DataMap
std::map< std::string, escript::Data > DataMap
Definition: ripley/src/domainhelpers.h:37
ripley::factorise
void factorise(std::vector< int > &factors, int product)
Definition: ripley/src/domainhelpers.cpp:41
ripley::unpackData
const escript::Data unpackData(const std::string target, const DataMap &mapping)
Definition: ripley/src/domainhelpers.h:41
speckley
Definition: AbstractAssembler.cpp:18
escript::Data
Data represents a collection of datapoints.
Definition: Data.h:63
speckley::factorise
void factorise(std::vector< int > &factors, int product)
Definition: speckley/src/domainhelpers.cpp:42
ripley::doublyLink
void doublyLink(std::vector< ripley::IndexVector > &va, std::vector< ripley::IndexVector > &vb, int a, int b)
Definition: ripley/src/domainhelpers.h:62
speckley::SpeckleyException
SpeckleyException exception class.
Definition: SpeckleyException.h:42