Example #1
0
File: Post.cpp Project: aefty/hdpc
void Post::LoadData(char* filename) {
	int i, j;

	ifstream infile(filename);

	if (infile.is_open()) {
		infile >> dim;
		infile >> nno;
		infile >> TotalDof;
		infile >> Level;
		infile >> gridType;

		int nsd = 2 * dim;
		index.redim(nno, nsd); index.fill(0);
		surplus.redim(nno, TotalDof); surplus.fill(0.0);
		i = 1;
		while (infile) {
			if (i == nno + 1) { break; }
			for ( j = 1; j <= nsd; j++)
			{    infile >> index(i, j); }
			for ( j = 1; j <= TotalDof; j++)
			{    infile >> surplus(i, j); }

			i++;
		}
		infile.close();
	} else {
void AdaptiveFreeList<FreeChunk>::print_on(outputStream* st, const char* c) const {
  if (c != NULL) {
    st->print("%16s", c);
  } else {
    st->print(SIZE_FORMAT_W(16), size());
  }
  st->print("\t"
           SSIZE_FORMAT_W(14) "\t" SSIZE_FORMAT_W(14) "\t" SSIZE_FORMAT_W(14) "\t" SSIZE_FORMAT_W(14) "\t" SSIZE_FORMAT_W(14) "\t"
           SSIZE_FORMAT_W(14) "\t" SSIZE_FORMAT_W(14) "\t" SSIZE_FORMAT_W(14) "\t" SSIZE_FORMAT_W(14) "\t" SSIZE_FORMAT_W(14) "\n",
           bfr_surp(),             surplus(),             desired(),             prev_sweep(),           before_sweep(),
           count(),               coal_births(),          coal_deaths(),          split_births(),         split_deaths());
}
size_t AdaptiveFreeList<Chunk>::get_better_size() {

  // A candidate chunk has been found.  If it is already under
  // populated and there is a hinT, REturn the hint().  Else
  // return the size of this chunk.
  if (surplus() <= 0) {
    if (hint() != 0) {
      return hint();
    } else {
      return size();
    }
  } else {
    // This list has a surplus so use it.
    return size();
  }
}