# include "imregister.h"
# include "imreg.h"

MosaicLayout *CreateCFH12K () {

  MosaicLayout *layout;

  ALLOCATE (layout, MosaicLayout, 1);

  layout[0].center.Nccd = 4;
  ALLOCATE (layout[0].center.ccd, int, layout[0].center.Nccd);
  layout[0].center.ccd[0] = 2;
  layout[0].center.ccd[1] = 3;
  layout[0].center.ccd[2] = 8;
  layout[0].center.ccd[3] = 9;

  layout[0].outer.Nccd = 8;
  ALLOCATE (layout[0].outer.ccd, int, layout[0].outer.Nccd);
  layout[0].outer.ccd[0] = 0;
  layout[0].outer.ccd[1] = 1;
  layout[0].outer.ccd[2] = 4;
  layout[0].outer.ccd[3] = 5;
  layout[0].outer.ccd[4] = 6;
  layout[0].outer.ccd[5] = 7;
  layout[0].outer.ccd[6] = 10;
  layout[0].outer.ccd[7] = 11;

  layout[0].top.Nccd = 6;
  ALLOCATE (layout[0].top.ccd, int, layout[0].top.Nccd);
  layout[0].top.ccd[0] = 0;
  layout[0].top.ccd[1] = 1;
  layout[0].top.ccd[2] = 2;
  layout[0].top.ccd[3] = 3;
  layout[0].top.ccd[4] = 4;
  layout[0].top.ccd[5] = 5;

  layout[0].bottom.Nccd = 6;
  ALLOCATE (layout[0].bottom.ccd, int, layout[0].bottom.Nccd);
  layout[0].bottom.ccd[0] = 6;
  layout[0].bottom.ccd[1] = 7;
  layout[0].bottom.ccd[2] = 8;
  layout[0].bottom.ccd[3] = 9;
  layout[0].bottom.ccd[4] = 10;
  layout[0].bottom.ccd[5] = 11;

  layout[0].left.Nccd = 6;
  ALLOCATE (layout[0].left.ccd, int, layout[0].left.Nccd);
  layout[0].left.ccd[0] = 0;
  layout[0].left.ccd[1] = 1;
  layout[0].left.ccd[2] = 2;
  layout[0].left.ccd[3] = 6;
  layout[0].left.ccd[4] = 7;
  layout[0].left.ccd[5] = 8;

  layout[0].right.Nccd = 6;
  ALLOCATE (layout[0].right.ccd, int, layout[0].right.Nccd);
  layout[0].right.ccd[0] = 3;
  layout[0].right.ccd[1] = 4;
  layout[0].right.ccd[2] = 5;
  layout[0].right.ccd[3] = 9;
  layout[0].right.ccd[4] = 10;
  layout[0].right.ccd[5] = 11;

  return (layout);
}

MosaicLayout *CreateMegaCam () {

  MosaicLayout *layout;

  ALLOCATE (layout, MosaicLayout, 1);

  layout[0].center.Nccd = 10;
  ALLOCATE (layout[0].center.ccd, int, layout[0].center.Nccd);
  layout[0].center.ccd[0] = 11;
  layout[0].center.ccd[1] = 12;
  layout[0].center.ccd[2] = 13;
  layout[0].center.ccd[3] = 14;
  layout[0].center.ccd[4] = 15;
  layout[0].center.ccd[5] = 20;
  layout[0].center.ccd[6] = 21;
  layout[0].center.ccd[7] = 22;
  layout[0].center.ccd[8] = 23;
  layout[0].center.ccd[9] = 24;

  layout[0].outer.Nccd = 26;
  ALLOCATE (layout[0].outer.ccd, int, layout[0].outer.Nccd);
  layout[0].outer.ccd[0] = 0;
  layout[0].outer.ccd[1] = 1;
  layout[0].outer.ccd[2] = 2;
  layout[0].outer.ccd[3] = 3;
  layout[0].outer.ccd[4] = 4;
  layout[0].outer.ccd[5] = 5;
  layout[0].outer.ccd[6] = 6;
  layout[0].outer.ccd[7] = 7;
  layout[0].outer.ccd[8] = 8;
  layout[0].outer.ccd[9] = 9;
  layout[0].outer.ccd[10] = 10;
  layout[0].outer.ccd[11] = 16;
  layout[0].outer.ccd[12] = 17;
  layout[0].outer.ccd[13] = 18;
  layout[0].outer.ccd[14] = 19;
  layout[0].outer.ccd[15] = 25;
  layout[0].outer.ccd[16] = 26;
  layout[0].outer.ccd[17] = 27;
  layout[0].outer.ccd[18] = 28;
  layout[0].outer.ccd[19] = 29;
  layout[0].outer.ccd[20] = 30;
  layout[0].outer.ccd[21] = 31;
  layout[0].outer.ccd[22] = 32;
  layout[0].outer.ccd[23] = 33;
  layout[0].outer.ccd[24] = 34;
  layout[0].outer.ccd[25] = 35;

  layout[0].top.Nccd = 9;
  ALLOCATE (layout[0].top.ccd, int, layout[0].top.Nccd);
  layout[0].top.ccd[0] = 0;
  layout[0].top.ccd[1] = 1;
  layout[0].top.ccd[2] = 2;
  layout[0].top.ccd[3] = 3;
  layout[0].top.ccd[4] = 4;
  layout[0].top.ccd[5] = 5;
  layout[0].top.ccd[6] = 6;
  layout[0].top.ccd[7] = 7;
  layout[0].top.ccd[8] = 8;

  layout[0].bottom.Nccd = 9;
  ALLOCATE (layout[0].bottom.ccd, int, layout[0].bottom.Nccd);
  layout[0].bottom.ccd[0] = 27;
  layout[0].bottom.ccd[1] = 28;
  layout[0].bottom.ccd[2] = 29;
  layout[0].bottom.ccd[3] = 30;
  layout[0].bottom.ccd[4] = 31;
  layout[0].bottom.ccd[5] = 32;
  layout[0].bottom.ccd[6] = 33;
  layout[0].bottom.ccd[7] = 34;
  layout[0].bottom.ccd[8] = 35;

  layout[0].left.Nccd = 8;
  ALLOCATE (layout[0].left.ccd, int, layout[0].left.Nccd);
  layout[0].left.ccd[0] = 0;
  layout[0].left.ccd[1] = 1;
  layout[0].left.ccd[2] = 9;
  layout[0].left.ccd[3] = 10;
  layout[0].left.ccd[4] = 18;
  layout[0].left.ccd[5] = 19;
  layout[0].left.ccd[6] = 27;
  layout[0].left.ccd[7] = 28;

  layout[0].right.Nccd = 8;
  ALLOCATE (layout[0].right.ccd, int, layout[0].right.Nccd);
  layout[0].right.ccd[0] = 7;
  layout[0].right.ccd[1] = 8;
  layout[0].right.ccd[2] = 16;
  layout[0].right.ccd[3] = 17;
  layout[0].right.ccd[4] = 25;
  layout[0].right.ccd[5] = 26;
  layout[0].right.ccd[6] = 34;
  layout[0].right.ccd[7] = 35;

  return (layout);
}

