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

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

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

/* DEFS: array ampi: ArrayElement{
ampi(CkMigrateMessage*);
ampi(AmpiStartMsg*);
void generic(AmpiMsg*);
threaded void run(ArgsInfo*);
threaded void run(void);
void migrate(void);
};
 */
#ifndef CK_TEMPLATES_ONLY
int CProxy_ampi::__idx=0;
#endif
#ifndef CK_TEMPLATES_ONLY
    void CProxy_ampi::__register(const char *s, size_t size) {
      __idx = CkRegisterChare(s, size);
  _REGISTER_BASE(__idx, CProxy_ArrayElement::__idx);
    /* REG: ampi(CkMigrateMessage*);
*/
      __idx_ampi_CkMigrateMessage = CkRegisterEp("ampi", (CkCallFnPtr)_call_ampi_CkMigrateMessage, 0, __idx);

    /* REG: ampi(AmpiStartMsg*);
*/
      __idx_ampi_AmpiStartMsg = CkRegisterEp("ampi", (CkCallFnPtr)_call_ampi_AmpiStartMsg, CMessage_AmpiStartMsg::__idx, __idx);

    /* REG: void generic(AmpiMsg*);
*/
      __idx_generic_AmpiMsg = CkRegisterEp("generic", (CkCallFnPtr)_call_generic_AmpiMsg, CMessage_AmpiMsg::__idx, __idx);

    /* REG: threaded void run(ArgsInfo*);
*/
      __idx_run_ArgsInfo = CkRegisterEp("run", (CkCallFnPtr)_call_run_ArgsInfo, CMessage_ArgsInfo::__idx, __idx);

    /* REG: threaded void run(void);
*/
      __idx_run_void = CkRegisterEp("run", (CkCallFnPtr)_call_run_void, 0, __idx);

    /* REG: void migrate(void);
*/
      __idx_migrate_void = CkRegisterEp("migrate", (CkCallFnPtr)_call_migrate_void, 0, __idx);
      CkRegisterMigCtor(__idx, __idx_ampi_CkMigrateMessage);
    }
#endif
#ifndef CK_TEMPLATES_ONLY
/* DEFS: ampi(CkMigrateMessage*);
 */
int CProxy_ampi::__idx_ampi_CkMigrateMessage=0;
void CProxy_ampi::_call_ampi_CkMigrateMessage(void* msg, ampi* obj)
{
  new (obj) ampi((CkMigrateMessage*)msg);
}

/* DEFS: ampi(AmpiStartMsg*);
 */
int CProxy_ampi::__idx_ampi_AmpiStartMsg=0;
CkArrayID CProxy_ampi::ckNew(AmpiStartMsg*msg, int numElements,CkGroupID mapID)
{ return CkArrayID(buildArrayGroup(__idx_ampi_AmpiStartMsg,numElements,mapID,msg));}
void CProxy_ampi::insert(AmpiStartMsg*msg, int onPE)
{ base_insert(__idx_ampi_AmpiStartMsg,onPE,msg);}
void CProxy_ampi::_call_ampi_AmpiStartMsg(void* msg, ampi* obj)
{
  new (obj) ampi((AmpiStartMsg*)msg);
}

/* DEFS: void generic(AmpiMsg*);
 */
int CProxy_ampi::__idx_generic_AmpiMsg=0;
void CProxy_ampi::generic(AmpiMsg*msg) const
{
      if(_idx.nInts==-1) 
        base_broadcast(msg, __idx_generic_AmpiMsg);
      else
        base_send(msg, __idx_generic_AmpiMsg);
}
void CProxy_ampi::_call_generic_AmpiMsg(void* msg, ampi* obj)
{
  obj->generic((AmpiMsg*)msg);
}

/* DEFS: threaded void run(ArgsInfo*);
 */
int CProxy_ampi::__idx_run_ArgsInfo=0;
void CProxy_ampi::run(ArgsInfo*msg) const
{
      if(_idx.nInts==-1) 
        base_broadcast(msg, __idx_run_ArgsInfo);
      else
        base_send(msg, __idx_run_ArgsInfo);
}
void CProxy_ampi::_call_run_ArgsInfo(void* msg, ampi* obj)
{
  CthAwaken(CthCreate((CthVoidFn)_callthr_run_ArgsInfo, new CkThrCallArg(msg,obj), 0));
}
void CProxy_ampi::_callthr_run_ArgsInfo(CkThrCallArg *arg)
{
  void *msg = arg->msg;
  ampi *obj = (ampi *) arg->obj;
  delete arg;
  obj->run((ArgsInfo*)msg);
}

/* DEFS: threaded void run(void);
 */
int CProxy_ampi::__idx_run_void=0;
void CProxy_ampi::run(void) const
{
      CkArrayMessage *msg=(CkArrayMessage*)CkAllocMsg(0, sizeof(CkArrayMessage),0);
      if(_idx.nInts==-1) 
        base_broadcast(msg, __idx_run_void);
      else
        base_send(msg, __idx_run_void);
}
void CProxy_ampi::_call_run_void(void* msg, ampi* obj)
{
  CthAwaken(CthCreate((CthVoidFn)_callthr_run_void, new CkThrCallArg(msg,obj), 0));
}
void CProxy_ampi::_callthr_run_void(CkThrCallArg *arg)
{
  void *msg = arg->msg;
  ampi *obj = (ampi *) arg->obj;
  delete arg;
  CkFreeMsg(msg);
  obj->run();
}

/* DEFS: void migrate(void);
 */
int CProxy_ampi::__idx_migrate_void=0;
void CProxy_ampi::migrate(void) const
{
      CkArrayMessage *msg=(CkArrayMessage*)CkAllocMsg(0, sizeof(CkArrayMessage),0);
      if(_idx.nInts==-1) 
        base_broadcast(msg, __idx_migrate_void);
      else
        base_send(msg, __idx_migrate_void);
}
void CProxy_ampi::_call_migrate_void(void* msg, ampi* obj)
{
  obj->migrate();
  CkFreeMsg(msg);
}
#endif /*CK_TEMPLATES_ONLY*/

#ifndef CK_TEMPLATES_ONLY
void _registerampi(void)
{
  static int _done = 0; if(_done) return; _done = 1;
      _registerMetisLB();

/* REG: message ArgsInfo;
*/
CMessage_ArgsInfo::__register("ArgsInfo", sizeof(ArgsInfo),(CkPackFnPtr) ArgsInfo::pack,(CkUnpackFnPtr) ArgsInfo::unpack);

/* REG: message AmpiMsg;
*/
CMessage_AmpiMsg::__register("AmpiMsg", sizeof(AmpiMsg),(CkPackFnPtr) AmpiMsg::pack,(CkUnpackFnPtr) AmpiMsg::unpack);

/* REG: message AmpiStartMsg;
*/
CMessage_AmpiStartMsg::__register("AmpiStartMsg", sizeof(AmpiStartMsg),(CkPackFnPtr) AmpiStartMsg::pack,(CkUnpackFnPtr) AmpiStartMsg::unpack);

/* REG: array ampi: ArrayElement{
ampi(CkMigrateMessage*);
ampi(AmpiStartMsg*);
void generic(AmpiMsg*);
threaded void run(ArgsInfo*);
threaded void run(void);
void migrate(void);
};
*/
  CProxy_ampi::__register("ampi", sizeof(ampi));

}
#endif
