FEI Package Browser (Single Doxygen Collection)
Version of the Day
Toggle main menu visibility
Loading...
Searching...
No Matches
base
fei_SharedIDs.hpp
Go to the documentation of this file.
1
/*--------------------------------------------------------------------*/
2
/* Copyright 2009 Sandia Corporation. */
3
/* Under the terms of Contract DE-AC04-94AL85000, there is a */
4
/* non-exclusive license for use of this work by or on behalf */
5
/* of the U.S. Government. Export of this program may require */
6
/* a license from the United States Government. */
7
/*--------------------------------------------------------------------*/
8
9
#ifndef _fei_SharedIDs_hpp_
10
#define _fei_SharedIDs_hpp_
11
12
#include <
fei_macros.hpp
>
13
14
#include <vector>
15
#include <set>
16
#include <map>
17
18
namespace
fei
{
19
21
template
<
typename
T>
22
class
SharedIDs
{
23
public
:
25
SharedIDs
()
26
:
sharedIDs_
(),
owningProcs_
()
27
{}
28
30
SharedIDs
(
const
SharedIDs<T>
& src)
31
:
sharedIDs_
(src.
sharedIDs_
),
owningProcs_
(src.
owningProcs_
)
32
{}
33
35
virtual
~SharedIDs
() {}
36
38
typedef
std::map<T,std::set<int> >
map_type
;
39
45
void
addSharedID
(
const
T& ID,
size_t
numSharingProcs,
const
int
* sharingProcs)
46
{
47
typename
map_type::iterator iter =
sharedIDs_
.find(ID);
48
if
(iter ==
sharedIDs_
.end()) {
49
iter =
sharedIDs_
.insert(std::make_pair(ID,std::set<int>())).first;
50
}
51
for
(
size_t
i=0; i<numSharingProcs; ++i) {
52
iter->second.insert(sharingProcs[i]);
53
}
54
}
55
57
map_type
&
getSharedIDs
() {
return
(
sharedIDs_
); }
58
60
const
map_type
&
getSharedIDs
()
const
{
return
(
sharedIDs_
); }
61
64
std::vector<int>&
getOwningProcs
() {
return
(
owningProcs_
); }
65
68
const
std::vector<int>&
getOwningProcs
()
const
{
return
(
owningProcs_
); }
69
70
private
:
71
map_type
sharedIDs_
;
72
std::vector<int>
owningProcs_
;
73
};
74
75
}
//namespace fei
76
77
#endif
// _fei_SharedIDs_hpp_
78
fei::SharedIDs::getSharedIDs
map_type & getSharedIDs()
Definition
fei_SharedIDs.hpp:57
fei::SharedIDs::sharedIDs_
map_type sharedIDs_
Definition
fei_SharedIDs.hpp:71
fei::SharedIDs::SharedIDs
SharedIDs()
Definition
fei_SharedIDs.hpp:25
fei::SharedIDs::getOwningProcs
std::vector< int > & getOwningProcs()
Definition
fei_SharedIDs.hpp:64
fei::SharedIDs::map_type
std::map< T, std::set< int > > map_type
Definition
fei_SharedIDs.hpp:38
fei::SharedIDs::addSharedID
void addSharedID(const T &ID, size_t numSharingProcs, const int *sharingProcs)
Definition
fei_SharedIDs.hpp:45
fei::SharedIDs::~SharedIDs
virtual ~SharedIDs()
Definition
fei_SharedIDs.hpp:35
fei::SharedIDs::owningProcs_
std::vector< int > owningProcs_
Definition
fei_SharedIDs.hpp:72
fei::SharedIDs::getSharedIDs
const map_type & getSharedIDs() const
Definition
fei_SharedIDs.hpp:60
fei::SharedIDs::SharedIDs
SharedIDs(const SharedIDs< T > &src)
Definition
fei_SharedIDs.hpp:30
fei::SharedIDs::getOwningProcs
const std::vector< int > & getOwningProcs() const
Definition
fei_SharedIDs.hpp:68
fei_macros.hpp
fei
Definition
fei_ArrayUtils.hpp:16
Generated by
1.17.0