/* DEFS: message TempoMessage;
 */
#ifndef CK_TEMPLATES_ONLY
void *CMessage_TempoMessage::operator new(size_t s){
  return TempoMessage::alloc(__idx, s, 0, 0);
}
void *CMessage_TempoMessage::operator new(size_t s,const int pb){
  return TempoMessage::alloc(__idx, s, 0, pb);
}
void *CMessage_TempoMessage::operator new(size_t s, int* sz){
  return TempoMessage::alloc(__idx, s, sz, 0);
}
void *CMessage_TempoMessage::operator new(size_t s, int* sz,const int pb){
  return TempoMessage::alloc(__idx, s, sz, pb);
}
void* CMessage_TempoMessage::alloc(int msgnum, size_t sz, int *sizes, int pb) {
  int offsets[1];
  offsets[0] = ALIGN8(sz);
  TempoMessage *newmsg = (TempoMessage *) CkAllocMsg(msgnum, offsets[0], pb);
  return (void *) newmsg;
}
void* CMessage_TempoMessage::pack(TempoMessage *msg) {
  return (void *) msg;
}
TempoMessage* CMessage_TempoMessage::unpack(void* buf) {
  TempoMessage *msg = (TempoMessage *) buf;
  return msg;
}
int CMessage_TempoMessage::__idx=0;
#endif

/* DEFS: chare TempoChare{
threaded TempoChare(void);
void tempoGeneric(TempoMessage*);
};
 */
#ifndef CK_TEMPLATES_ONLY
int CProxy_TempoChare::__idx=0;
#endif
#ifndef CK_TEMPLATES_ONLY
    void CProxy_TempoChare::__register(const char *s, size_t size) {
      __idx = CkRegisterChare(s, size);
    /* REG: threaded TempoChare(void);
*/
      __idx_TempoChare_void = CkRegisterEp("TempoChare", (CkCallFnPtr)_call_TempoChare_void, 0, __idx);

    /* REG: void tempoGeneric(TempoMessage*);
*/
      __idx_tempoGeneric_TempoMessage = CkRegisterEp("tempoGeneric", (CkCallFnPtr)_call_tempoGeneric_TempoMessage, CMessage_TempoMessage::__idx, __idx);
    }
#endif
#ifndef CK_TEMPLATES_ONLY
/* DEFS: threaded TempoChare(void);
 */
int CProxy_TempoChare::__idx_TempoChare_void=0;
void CProxy_TempoChare::ckNew(int onPE)
{
      void *msg = CkAllocSysMsg();
  CkCreateChare(__idx, __idx_TempoChare_void, msg, 0, onPE);
}
void CProxy_TempoChare::ckNew(CkChareID* pcid, int onPE)
{
      void *msg = CkAllocSysMsg();
  CkCreateChare(__idx, __idx_TempoChare_void, msg, pcid, onPE);
}
  CProxy_TempoChare::CProxy_TempoChare(int onPE)
{
      void *msg = CkAllocSysMsg();
  CkCreateChare(__idx, __idx_TempoChare_void, msg, &_ck_cid, onPE);
}
void CProxy_TempoChare::_call_TempoChare_void(void* msg, TempoChare* obj)
{
  CthAwaken(CthCreate((CthVoidFn)_callthr_TempoChare_void, new CkThrCallArg(msg,obj), 0));
}
void CProxy_TempoChare::_callthr_TempoChare_void(CkThrCallArg *arg)
{
  void *msg = arg->msg;
  TempoChare *obj = (TempoChare *) arg->obj;
  delete arg;
  new (obj) TempoChare();
  CkFreeSysMsg(msg);
}

/* DEFS: void tempoGeneric(TempoMessage*);
 */
int CProxy_TempoChare::__idx_tempoGeneric_TempoMessage=0;
void CProxy_TempoChare::tempoGeneric(TempoMessage*msg)
{
  CkSendMsg(__idx_tempoGeneric_TempoMessage, msg, &_ck_cid);
}
void CProxy_TempoChare::_call_tempoGeneric_TempoMessage(void* msg, TempoChare* obj)
{
  obj->tempoGeneric((TempoMessage*)msg);
}
#endif /*CK_TEMPLATES_ONLY*/

/* DEFS: group TempoGroup{
threaded TempoGroup(void);
void tempoGeneric(TempoMessage*);
};
 */
#ifndef CK_TEMPLATES_ONLY
int CProxy_TempoGroup::__idx=0;
#endif
#ifndef CK_TEMPLATES_ONLY
    void CProxy_TempoGroup::__register(const char *s, size_t size) {
      __idx = CkRegisterChare(s, size);
    /* REG: threaded TempoGroup(void);
*/
      __idx_TempoGroup_void = CkRegisterEp("TempoGroup", (CkCallFnPtr)_call_TempoGroup_void, 0, __idx);

    /* REG: void tempoGeneric(TempoMessage*);
*/
      __idx_tempoGeneric_TempoMessage = CkRegisterEp("tempoGeneric", (CkCallFnPtr)_call_tempoGeneric_TempoMessage, CMessage_TempoMessage::__idx, __idx);
    }
#endif
#ifndef CK_TEMPLATES_ONLY
/* DEFS: threaded TempoGroup(void);
 */
int CProxy_TempoGroup::__idx_TempoGroup_void=0;
CkGroupID CProxy_TempoGroup::ckNew(void)
{
      void *msg = CkAllocSysMsg();
  return CkCreateGroup(__idx, __idx_TempoGroup_void, msg, 0, 0);
}
CkGroupID CProxy_TempoGroup::ckNewSync(void)
{
      void *msg = CkAllocSysMsg();
  return CkCreateGroupSync(__idx, __idx_TempoGroup_void, msg);
}
  CProxy_TempoGroup::CProxy_TempoGroup(int retEP, CkChareID *cid)
{
      void *msg = CkAllocSysMsg();
  _ck_gid = CkCreateGroup(__idx, __idx_TempoGroup_void, msg, retEP, cid);
  _setChare(0);
}
  CProxy_TempoGroup::CProxy_TempoGroup(void)
{
      void *msg = CkAllocSysMsg();
  _ck_gid = CkCreateGroup(__idx, __idx_TempoGroup_void, msg, 0, 0);
  _setChare(0);
}
void CProxy_TempoGroup::_call_TempoGroup_void(void* msg, TempoGroup* obj)
{
  CthAwaken(CthCreate((CthVoidFn)_callthr_TempoGroup_void, new CkThrCallArg(msg,obj), 0));
}
void CProxy_TempoGroup::_callthr_TempoGroup_void(CkThrCallArg *arg)
{
  void *msg = arg->msg;
  TempoGroup *obj = (TempoGroup *) arg->obj;
  delete arg;
  new (obj) TempoGroup();
  CkFreeSysMsg(msg);
}

/* DEFS: void tempoGeneric(TempoMessage*);
 */
int CProxy_TempoGroup::__idx_tempoGeneric_TempoMessage=0;
void CProxy_TempoGroup::_call_tempoGeneric_TempoMessage(void* msg, TempoGroup* obj)
{
  obj->tempoGeneric((TempoMessage*)msg);
}
#endif /*CK_TEMPLATES_ONLY*/

/* DEFS: array TempoArray: ArrayElement{
TempoArray(CkMigrateMessage*);
threaded TempoArray(void);
void tempoGeneric(TempoMessage*);
};
 */
#ifndef CK_TEMPLATES_ONLY
int CProxy_TempoArray::__idx=0;
#endif
#ifndef CK_TEMPLATES_ONLY
    void CProxy_TempoArray::__register(const char *s, size_t size) {
      __idx = CkRegisterChare(s, size);
  _REGISTER_BASE(__idx, CProxy_ArrayElement::__idx);
    /* REG: TempoArray(CkMigrateMessage*);
*/
      __idx_TempoArray_CkMigrateMessage = CkRegisterEp("TempoArray", (CkCallFnPtr)_call_TempoArray_CkMigrateMessage, 0, __idx);

    /* REG: threaded TempoArray(void);
*/
      __idx_TempoArray_void = CkRegisterEp("TempoArray", (CkCallFnPtr)_call_TempoArray_void, 0, __idx);

    /* REG: void tempoGeneric(TempoMessage*);
*/
      __idx_tempoGeneric_TempoMessage = CkRegisterEp("tempoGeneric", (CkCallFnPtr)_call_tempoGeneric_TempoMessage, CMessage_TempoMessage::__idx, __idx);
      CkRegisterMigCtor(__idx, __idx_TempoArray_CkMigrateMessage);
    }
#endif
#ifndef CK_TEMPLATES_ONLY
/* DEFS: TempoArray(CkMigrateMessage*);
 */
int CProxy_TempoArray::__idx_TempoArray_CkMigrateMessage=0;
void CProxy_TempoArray::_call_TempoArray_CkMigrateMessage(void* msg, TempoArray* obj)
{
  new (obj) TempoArray((CkMigrateMessage*)msg);
}

/* DEFS: threaded TempoArray(void);
 */
int CProxy_TempoArray::__idx_TempoArray_void=0;
CkArrayID CProxy_TempoArray::ckNew(int numElements,CkGroupID mapID)
{ return CkArrayID(buildArrayGroup(__idx_TempoArray_void,numElements,mapID,NULL));}
void CProxy_TempoArray::insert(int onPE)
{ base_insert(__idx_TempoArray_void,onPE,NULL);}
void CProxy_TempoArray::_call_TempoArray_void(void* msg, TempoArray* obj)
{
  CthAwaken(CthCreate((CthVoidFn)_callthr_TempoArray_void, new CkThrCallArg(msg,obj), 0));
}
void CProxy_TempoArray::_callthr_TempoArray_void(CkThrCallArg *arg)
{
  void *msg = arg->msg;
  TempoArray *obj = (TempoArray *) arg->obj;
  delete arg;
  new (obj) TempoArray();
  CkFreeMsg(msg);
}

/* DEFS: void tempoGeneric(TempoMessage*);
 */
int CProxy_TempoArray::__idx_tempoGeneric_TempoMessage=0;
void CProxy_TempoArray::tempoGeneric(TempoMessage*msg) const
{
      if(_idx.nInts==-1) 
        base_broadcast(msg, __idx_tempoGeneric_TempoMessage);
      else
        base_send(msg, __idx_tempoGeneric_TempoMessage);
}
void CProxy_TempoArray::_call_tempoGeneric_TempoMessage(void* msg, TempoArray* obj)
{
  obj->tempoGeneric((TempoMessage*)msg);
}
#endif /*CK_TEMPLATES_ONLY*/

#ifndef CK_TEMPLATES_ONLY
void _registertempo(void)
{
  static int _done = 0; if(_done) return; _done = 1;
/* REG: message TempoMessage;
*/
CMessage_TempoMessage::__register("TempoMessage", sizeof(TempoMessage),(CkPackFnPtr) TempoMessage::pack,(CkUnpackFnPtr) TempoMessage::unpack);

/* REG: chare TempoChare{
threaded TempoChare(void);
void tempoGeneric(TempoMessage*);
};
*/
  CProxy_TempoChare::__register("TempoChare", sizeof(TempoChare));

/* REG: group TempoGroup{
threaded TempoGroup(void);
void tempoGeneric(TempoMessage*);
};
*/
  CProxy_TempoGroup::__register("TempoGroup", sizeof(TempoGroup));

/* REG: array TempoArray: ArrayElement{
TempoArray(CkMigrateMessage*);
threaded TempoArray(void);
void tempoGeneric(TempoMessage*);
};
*/
  CProxy_TempoArray::__register("TempoArray", sizeof(TempoArray));

}
#endif
