Example #1
0
static COMMAND_FUNC( do_dobj_info )
{
	Data_Obj *dp;

	dp=pick_obj("");
	if( dp==NULL ) return;

	longlist(dp);
}
Example #2
0
static int _dim_is_power_of_two( QSP_ARG_DECL  Data_Obj *dp, int dim_idx, const char *funcname )
{
	if( log_2( OBJ_DIMENSION(dp,dim_idx) ) == -1 ){
		sprintf(ERROR_STRING,
	"%s:  Number of %ss of image %s (%d) is not a power of two!?", funcname,
			dimension_name[dim_idx],OBJ_NAME(dp),OBJ_DIMENSION(dp,dim_idx));
		WARN(ERROR_STRING);
		longlist(dp);
		return FALSE;
	}
	return TRUE;
}
Example #3
0
static int _fft_row_size_ok(QSP_ARG_DECL  Data_Obj *dp, const char * funcname )
{
	if( log_2(OBJ_COLS(dp)) == -1 ){
		sprintf(ERROR_STRING,
	"%s:  number of columns of image %s (%d) is not a power of two for FFT",
			funcname,OBJ_NAME(dp),OBJ_COLS(dp));
		WARN(ERROR_STRING);
		longlist(dp);
		return(-1);
	}

	return(0);
}
Example #4
0
File: ascmenu.c Project: E-LLP/QuIP
static Data_Obj *insure_ram_obj(QSP_ARG_DECL  Data_Obj *dp)
{
	Data_Obj *tmp_dp;
	char *tname;
	Data_Area *save_ap;
	Data_Obj *c_dp=NULL;

	if( OBJ_IS_RAM(dp) ) return dp;

	// This object lives on a different platform.
	// We create a copy in RAM, and download the data
	// using the platform download function.

	save_ap = curr_ap;
	curr_ap = ram_area_p;

	tname = getbuf( strlen(OBJ_NAME(dp)) + strlen(DNAME_PREFIX) + 1 );
	sprintf(tname,"%s%s",DNAME_PREFIX,OBJ_NAME(dp));
	tmp_dp = dup_obj(QSP_ARG  dp, tname);
	givbuf(tname);
	if( tmp_dp == NO_OBJ ){
		// This can happen if the object is subscripted,
		// as the bracket characters are illegal in names
		return NO_OBJ;
	}

	curr_ap = save_ap;

	// We can't download if the source data is not contiguous...
	//
	// We have a problem with bit precision, because the bits can
	// be non-contiguous when the long words are - any time the number of columns
	// is not evenly divided by the bits-per-word

	if( (! IS_CONTIGUOUS(dp)) && ! HAS_CONTIGUOUS_DATA(dp) ){
		Vec_Obj_Args oa1, *oap=&oa1;

advise("object is not contiguous, and does not have contiguous data...");
longlist(QSP_ARG  dp);
		save_ap = curr_ap;
		curr_ap = OBJ_AREA( dp );

		tname = getbuf( strlen(OBJ_NAME(dp)) + strlen(CNAME_PREFIX) + 1 );
		sprintf(tname,"%s%s",CNAME_PREFIX,OBJ_NAME(dp));
		c_dp = dup_obj(QSP_ARG  dp, tname );
		givbuf(tname);

		curr_ap = save_ap;

		// Now do the move...

		setvarg2(oap,c_dp,dp);
		if( IS_BITMAP(dp) ){
			SET_OA_SBM(oap,dp);
			SET_OA_SRC1(oap,NO_OBJ);
		}

		if( IS_REAL(dp) ) /* BUG case for QUAT too? */
			OA_ARGSTYPE(oap) = REAL_ARGS;
		else if( IS_COMPLEX(dp) ) /* BUG case for QUAT too? */
			OA_ARGSTYPE(oap) = COMPLEX_ARGS;
		else if( IS_QUAT(dp) ) /* BUG case for QUAT too? */
			OA_ARGSTYPE(oap) = QUATERNION_ARGS;
		else
			//ERROR1("CAUTIOUS:  insure_ram_obj:  bad argset type!?");
			assert( AERROR("insure_ram_obj:  bad argset type!?") );

//fprintf(stderr,"insure_ram_obj:  moving remote data to a contiguous object\n");  
		call_vfunc( QSP_ARG  FIND_VEC_FUNC(FVMOV), oap );
//fprintf(stderr,"insure_ram_obj:  DONE moving remote data to a contiguous object\n");  

		dp = c_dp;
	}

	gen_obj_dnload(QSP_ARG  tmp_dp, dp);

	if( c_dp != NO_OBJ )
		delvec(QSP_ARG  c_dp);

	// BUG - when to delete?
	// We try using the VOLATILE flag.  This will work as long as
	// the input object is not VOLATILE!?

	SET_OBJ_FLAG_BITS(tmp_dp, DT_VOLATILE ) ;

	return tmp_dp;
}