当前位置: 首页>>代码示例>>C++>>正文


C++ Orderizer::save_mesh_vtk方法代码示例

本文整理汇总了C++中Orderizer::save_mesh_vtk方法的典型用法代码示例。如果您正苦于以下问题:C++ Orderizer::save_mesh_vtk方法的具体用法?C++ Orderizer::save_mesh_vtk怎么用?C++ Orderizer::save_mesh_vtk使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Orderizer的用法示例。


在下文中一共展示了Orderizer::save_mesh_vtk方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main


//.........这里部分代码省略.........
      highOrd.assemble_High_Order(conv_matrix,mass_matrix);

      mass_matrix->multiply_with_Scalar(time_step);  // massmatrix = M_C
      lumped_matrix->multiply_with_Scalar(time_step);  // M_L


      //--------- Project the previous timestep solution on the FE space (FCT is applied )----------------			
      // coeff_vec : FCT -Projection, coeff_vec_2: L2 Projection (ogProjection)	
      if(ts==1)
        fluxCorrection.project_FCT(&initial_condition, coeff_vec, coeff_vec_2,mass_matrix,lumped_matrix,time_step,&ogProjection,&lumpedProjection, &regEst);	
      else		
        fluxCorrection.project_FCT(&u_prev_time, coeff_vec, coeff_vec_2,mass_matrix,lumped_matrix,time_step,&ogProjection,&lumpedProjection, &regEst);			
      //------------------------- lower order solution------------					
      u_L = lowOrder.solve_Low_Order(lumped_matrix, coeff_vec,time_step);								
      //-------------high order solution (standard galerkin) ------				
      u_H = highOrd.solve_High_Order(coeff_vec);		
      //------------------------------Assemble antidiffusive fluxes and limit these-----------------------------------	
      fluxCorrection.antidiffusiveFlux(mass_matrix,lumped_matrix,conv_matrix,diffusion,u_H, u_L,coeff_vec, limited_flux,time_step,&regEst);
      //-------------Compute final solution ---------------			
      ref_sln_double = lowOrder.explicit_Correction(limited_flux);
      Solution<double> ::vector_to_solution(ref_sln_double, ref_space, &ref_sln);	

      // Project the fine mesh solution onto the coarse mesh.
      ogProjection.project_global(&space, &ref_sln, &sln, HERMES_L2_NORM); 
      // Calculate element errors and total error estimate.
      err_est_rel_total = adaptivity.calc_err_est(&sln, &ref_sln) * 100;
      // Report results.
      Hermes::Mixins::Loggable::Static::info("ndof_coarse: %d, ndof_fine: %d, err_est_rel: %g%%", ndof,ref_ndof, err_est_rel_total);				
      // If err_est_rel too large, adapt the mesh.
      if((err_est_rel_total < ERR_STOP)||(as>=ADAPSTEP_MAX)) done = true;
      else
      {
        done = adaptivity.adapt(&selector, THRESHOLD, STRATEGY, MESH_REGULARITY);
        // Increase the counter of performed adaptivity steps.
        if(done == false)  as++;
      }
      if(space.get_num_dofs() >= NDOF_STOP)
        done = true;

      if(done) 
      {  
        u_prev_time.copy(&ref_sln);
        u_prev_time.set_own_mesh(ref_mesh); //ref_mesh can be deleted
      }

      // Visualize the solution and mesh.
      if(HERMES_VISUALIZATION)
      {
        sprintf(title, "Ref-Loesung: Time %3.2f,timestep %i,as=%i,", current_time,ts,as);
        sview.set_title(title);
        sview.show(&ref_sln);
        sprintf(title, "Mesh: Time %3.2f,timestep %i,as=%i,", current_time,ts,as);
        mview.set_title(title);
        mview.show(&space);
      }

      if((VTK_VISUALIZATION) &&((done==true)&&(ts  % VTK_FREQ == 0)))
      {
        // Output solution in VTK format.
        char filename[40];
        sprintf(filename, "solution-%i.vtk", ts );
        lin.save_solution_vtk(&u_prev_time, filename, "solution", mode_3D);  
        sprintf(filename, "ref_space_order-%i.vtk", ts);
        ord.save_orders_vtk(ref_space, filename);
        sprintf(filename, "ref_mesh-%i.vtk", ts );
        ord.save_mesh_vtk(ref_space, filename);       
      } 

      // Clean up.
      delete lumped_matrix; 
      delete diffusion;
      delete [] coeff_vec_2;
      delete [] coeff_vec; 
      delete [] limited_flux; 
      delete ref_mesh; 
      delete ref_space; 
    }
    while (done == false);

    // Update global time.
    current_time += time_step;
    // Increase time step counter
    ts++;
  }
  while (current_time < T_FINAL); 

  // Visualize the solution.
  if(VTK_VISUALIZATION) {
    lin.save_solution_vtk(&u_prev_time, "end_solution.vtk", "solution", mode_3D);
    ord.save_mesh_vtk(&space, "end_mesh");
    ord.save_orders_vtk(&space, "end_order.vtk");
  }

  delete mass_matrix;  
  delete conv_matrix;

  // Wait for the view to be closed.
  View::wait();
  return 0;
}
开发者ID:fauzisd,项目名称:hermes,代码行数:101,代码来源:main.cpp


注:本文中的Orderizer::save_mesh_vtk方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。