source: colin/trunk/src/EvaluationID.cpp @ 5786

Revision 5786, 2.1 KB checked in by wehart, 5 years ago (diff)

Update of source to include Acro copyright statement

Line 
1/*  _________________________________________________________________________
2 *
3 *  Acro: A Common Repository for Optimizers
4 *  Copyright (c) 2008 Sandia Corporation.
5 *  This software is distributed under the BSD License.
6 *  Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
7 *  the U.S. Government retains certain rights in this software.
8 *  For more information, see the README.txt file in the top Acro directory.
9 *  _________________________________________________________________________
10 */
11
12#include <colin/EvaluationID.h>
13#include <colin/ColinGlobals.h>
14
15#include <utilib/exception_mngr.h>
16
17
18using std::map;
19using std::cerr;
20using std::endl;
21
22
23///
24std::ostream& operator<<(std::ostream& os, const colin::EvaluationID& id)
25{
26   os << "(" << id.m_rank << "-" << id.m_eMngr << ":"
27      << id.m_solver << "-" << id.m_queue
28      << ":" << id.m_id << ")";
29   return os;
30}
31
32
33namespace colin
34{
35
36//======================================================================
37// EvaluationID member functions
38//======================================================================
39
40EvaluationID::EvaluationID( QueueManager::evalMngrID_t eID,
41                            QueueManager::solverID_t sID,
42                            QueueManager::queueID_t qID )
43   : m_rank(ColinGlobals::processor_id()),
44     m_eMngr(eID),
45     m_solver(sID),
46     m_queue(qID),
47     m_id(getNewFEvalID())
48{}
49
50
51size_t EvaluationID::getNewFEvalID()
52{
53   static size_t lastFEvalID = 0;
54   return ++lastFEvalID;
55}
56
57
58bool EvaluationID::operator==(const EvaluationID& rhs) const
59{
60   return ( m_id == rhs.m_id ) && ( m_rank == rhs.m_rank );
61}
62
63
64bool EvaluationID::operator<(const EvaluationID& rhs) const
65{
66   if (m_id < rhs.m_id) return true;
67   if (m_id > rhs.m_id) return false;
68   if (m_queue < rhs.m_queue) return true;
69   if (m_queue > rhs.m_queue) return false;
70   if (m_solver < rhs.m_solver) return true;
71   if (m_solver > rhs.m_solver) return false;
72   if (m_eMngr < rhs.m_eMngr) return true;
73   if (m_eMngr > rhs.m_eMngr) return false;
74   if (m_rank < rhs.m_rank) return true;
75   if (m_rank > rhs.m_rank) return false;
76   return false;
77}
78
79
80} // namespace colin
Note: See TracBrowser for help on using the repository browser.