//=========================================================================
// Constructor
EpetraExt_BlockDiagMatrix::EpetraExt_BlockDiagMatrix(const Epetra_BlockMap& Map,bool zero_out)
  : Epetra_DistObject(Map, "EpetraExt::BlockDiagMatrix"),
    HasComputed_(false),
    ApplyMode_(AM_MULTIPLY),
    DataMap_(0),
    Values_(0),
    Pivots_(0)
{
  Allocate();
  if(zero_out) PutScalar(0.0);
}
Exemple #2
0
static void PutData(hid_t obj, char dtype, int htype, int size, int n_dims, hsize_t *dims,int is_attr, struct descriptor_xd *xd)
{
  /*********************************************
  Read data from HDF5 file using H5Aread for
  attributes and H5Dread for datasets. Load the
  data into MDSplus nodes.
  *********************************************/
  if (dtype)
  {
    char *mem;
/*     if (dtype == DTYPE_T) { */
/*       hid_t type = H5Aget_type(obj); */
/*       int slen = H5Tget_size (type); */
/*       if (slen <0) { */
/* 	printf("Badly formed string attribute\n"); */
/*       } else { */
/* 	mem = (char *) malloc((slen+1)*sizeof(char)); */
/* 	hid_t st_id = H5Tcopy (H5T_C_S1); */
/*         size=slen; */
/* 	H5Tset_size (st_id, slen); */
/* 	if (H5Aread(obj, st_id, (void *)mem)) { */
/* 	  printf("error reading string\n"); */
/*           free(mem); */
/*           return; */
/* 	} */
/*       } */
/*     } else { */
      int  array_size = 1;
      int i;
      for (i=0;i<n_dims;i++) array_size *= dims[i];
      mem = malloc(size*array_size);
      if (is_attr)
	H5Aread ( obj, htype, (void *)mem);
      else
	/* printf("H5Dread: obj = %p, htype = %d, status = %d\n",obj,htype, */
	H5Dread ( obj, htype, H5S_ALL, H5S_ALL, H5P_DEFAULT, (void *)mem) /* ) */ ;
/*     } */
    if (n_dims > 0)
      PutArray(dtype, size, n_dims, dims, mem, xd);
    else
      PutScalar(dtype, size, mem, xd);
    free(mem);
  }
}