Esempio n. 1
0
void App::adapt_mesh() 
{
  getIndicator();
 
  double convergence_order = 2.0;
  double adapt_tolerence = 1.0e-03;

  memoryReclaim();

  ir_mesh_t * old_ir_mesh = ir_mesh;
  fe_space_t * old_fem_space = fem_space;
  fe_func_t * old_phi_h = phi_h;
  fe_func_t * old_alpha_h = alpha_h;
  fe_func_t * old_c_h = c_h;
  fe_func_t * old_u_h = u_h;
  fe_func_t * old_v_h = v_h;
  fe_func_t * old_p_h = p_h;
  fe_func_t * old_last_p_h = last_p_h;
  
  ir_mesh = new ir_mesh_t(*old_ir_mesh);
 
  //MeshAdaptor<DIM> mesh_adaptor(*old_ir_mesh,*ir_mesh);
  MeshAdaptor<DIM> mesh_adaptor(*ir_mesh);
  mesh_adaptor.convergenceOrder() = convergence_order;
  mesh_adaptor.refineStep() = 1;
  mesh_adaptor.setIndicator(*indicator);
  mesh_adaptor.tolerence() = adapt_tolerence;
  mesh_adaptor.adapt();

  ir_mesh->semiregularize();
  ir_mesh->regularize(false);
 
  build_femspace();
  
  Operator::L2Interpolate(*old_phi_h, *phi_h);
  Operator::L2Interpolate(*old_alpha_h, *alpha_h);
  Operator::L2Interpolate(*old_c_h, *c_h);
  delete old_phi_h;old_phi_h=NULL;
  delete old_alpha_h;old_alpha_h=NULL;
  delete old_c_h;old_c_h=NULL;
	Operator::L2Interpolate(*old_u_h,*u_h);
	Operator::L2Interpolate(*old_v_h,*v_h);
	Operator::L2Interpolate(*old_p_h,*p_h);
	Operator::L2Interpolate(*old_last_p_h,*last_p_h);
	delete old_u_h; old_u_h = NULL;
	delete old_v_h; old_v_h = NULL;
	delete old_p_h; old_p_h = NULL;
	delete old_last_p_h; old_last_p_h = NULL;
  //Operator::L2Project(*old_phi_h, *phi_h, Operator::LOCAL_LEAST_SQUARE, 5);
  //Operator::L2Project(*old_c_h, *c_h, Operator::LOCAL_LEAST_SQUARE, 5);
  //memoryReclaim(old_ir_mesh);
  //memoryReclaim(ir_mesh);
  //memoryReclaim();
  delete old_fem_space;old_fem_space=NULL;
  delete old_ir_mesh;old_ir_mesh=NULL;
}
Esempio n. 2
0
char *
parse4last( char * bufptr )
{
  char
    *startname,
    *indicator;

  while (*bufptr != 0) {
    if (*bufptr == '<') {
      // TAG
      bufptr++;
      if (*bufptr != '/') {
	// START TAG
	startname = getGI(bufptr);
	bufptr = bufptr + strlen(startname);
	indicator = getIndicator(bufptr);
	// move buffer pointer past the end of the attributes.  Assuming
	// that indicator is pointing at the character position where the
	// value is stored we need to move past it and the characters
	// "</#LAST></#>"
	bufptr = indicator + 13;
	// parse the content of this tag past its end tag and when it
	// returns get to the end of where that parse got to.
	bufptr = parse4last( bufptr );
	// Handle the end tag
	if (*bufptr == 0) {
	  // end of the buffer, so it is automatically last...
	  *indicator = '2';  // LASTONLEVEL
	} else {
	  lookahead(bufptr, startname, indicator);
	}
	delete startname;
      } else {
	// END TAG
	for ( ; *bufptr != '>'; bufptr++) {
	  // Just move the pointer past the tag name.
	}
	bufptr++; // Get past the '>'
	return(bufptr);
      }
    } else {
      // Data
      bufptr++;
    }
  }
  return(bufptr);
}
void PredictiveRefinement::collectRefinablePoints(
  GridStorage* storage, RefinementFunctor* functor,
  AbstractRefinement::refinement_container_type& collection) {
  size_t refinements_num = functor->getRefinementsNum();

  index_type index;
  GridStorage::grid_map_iterator end_iter = storage->end();

  // start iterating over whole grid
  for (GridStorage::grid_map_iterator iter = storage->begin();
       iter != end_iter; iter++) {
    index = *(iter->first);
    AbstractRefinement::refinement_list_type current_value_list = getIndicator(
          storage, iter, functor);
    addElementToCollection(iter, current_value_list, refinements_num,
                           collection);
  }
}