/* $Header: oneDarray_to_vey.m,v 1.1 91/08/23 16:28:14 chu mp310d $

                    Copyright (c) 1991
                    MasPar Computer Corporation
                    All Rights Reserved

    This program has been licensed subject to restrictions
    on reproduction, use and disclosure and this notice
    does not imply that the program or the related ideas
    or algorithms are in the public domain.

	example to blockIn a fe f77 double precision array fe_a(n)
	into a vex in mplabb
	this is same for a fe c double 
*/

#include <mpl.h>

void oneDarray_to_vey(fe_a,be_a,n) 
int n;			 	/* # of elements of 1-D array fe_a */
double *fe_a;			/* 1-D array fe_a */
register plural double *be_a;	/* mpl memory layers to hold fe_a */

{
   register int nba;		/* # of blocks - 1 */
   register int npa;		/* the remainder of blocks */
   int npaa;			/* # of columns of pe's - 1 */
   int npap;			/* the remainder of columns */
   
   register int j, k;		/* for loops index */

   nba = n>>lnproc;		/* nba = n / nproc */
   npa = n - (nba<<lnproc);	/* npa = n % nproc */

   for ( j=0; j<nba; j++ ) {
      for ( k=0; k<nxproc; k++ ) {
         blockIn(fe_a,be_a,k,0,1,nyproc,sizeof(double));
         fe_a += nyproc;
      }
      be_a++;
   }

   if ( npa > 0 ) {
      npaa = npa >> lnyproc;
      for ( j=0; j<npaa; j++ ) {
         blockIn(fe_a,be_a,j,0,1,nyproc,sizeof(double));
         fe_a += nyproc;
      }
      npap = npa - (npaa << lnyproc);
      if ( npap > 0 )
         blockIn(fe_a,be_a,npaa,0,1,npap,sizeof(double));
   }
}
