MOOSE - Multiscale Object Oriented Simulation Environment
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
ShellThreads.cpp
Go to the documentation of this file.
1 /**********************************************************************
2 ** This program is part of 'MOOSE', the
3 ** Messaging Object Oriented Simulation Environment.
4 ** Copyright (C) 2003-2010 Upinder S. Bhalla. and NCBS
5 ** It is made available under the terms of the
6 ** GNU Lesser General Public License version 2.1
7 ** See the file COPYING.LIB for the full notice.
8 **********************************************************************/
9 
14 #ifdef USE_MPI
15 #include <mpi.h>
16 #endif
17 #include "header.h"
18 #include "Shell.h"
19 #include "Dinfo.h"
20 
21 #define USE_NODES 1
22 
24 
29 {
30  Id shellId;
31  Shell* s = reinterpret_cast< Shell* >( shellId.eref().data() );
32  bool quit = 0;
33 
34  cout << "moose : " << flush;
35  while ( !quit ) {
36  string temp;
37  cin >> temp;
38  if ( temp == "quit" || temp == "q" ) {
39  s->doQuit();
40  quit = 1;
41  }
42  }
43  cout << "\nQuitting Moose\n" << flush;
44 }
45 
46 // Function to assign hardware availability
47 void Shell::setHardware( unsigned int numCores, unsigned int numNodes,
48  unsigned int myNode )
49 {
52  myNode_ = myNode;
53  acked_.resize( numNodes, 0 );
54 }
55 
61 {
62  // Need more info here on how to set up groups distributed over
63  // nodes. In fact this will have to be computed _after_ the
64  // simulation is loaded. Will also need quite a bit of juggling between
65  // nodes when things get really scaled up.
66  //
67  // Note that the messages have to be rebuilt after this call.
68  // Note that this function is called independently on each node.
69 }
70 
71 unsigned int Shell::numCores()
72 {
73  return numCores_;
74 }
75 
76 unsigned int Shell::numNodes()
77 {
78  return numNodes_;
79 }
80 
81 unsigned int Shell::myNode()
82 {
83  return myNode_;
84 }
85 
87 {
88  return isBlockedOnParser_;
89 }
static unsigned int numCores
static unsigned int myNode_
Definition: Shell.h:606
char * data() const
Definition: Eref.cpp:41
static unsigned int numCores()
static void setHardware(unsigned int numCores, unsigned int numNodes, unsigned int myNode)
static void launchParser()
Eref eref() const
Definition: Id.cpp:125
static unsigned int numNodes_
Definition: Shell.h:601
static bool isBlockedOnParser_
Definition: Shell.h:577
static unsigned int myNode
static unsigned int numCores_
Definition: Shell.h:588
static bool inBlockingParserCall()
void doQuit()
Definition: Shell.cpp:327
static void loadBalance()
static unsigned int numNodes
Definition: Id.h:17
static unsigned int myNode()
static vector< unsigned int > acked_
Definition: Shell.h:622
static unsigned int numNodes()
Definition: Shell.h:43