Exemple #1
0
typename enable_if<
  typename gtl_and<
    y_pt_transform,
    typename is_mutable_point_concept<
      typename geometry_concept<PointType>::type
    >::type
  >::type,
PointType>::type& transform(PointType& point, const TransformType& transform) {
  typedef typename point_coordinate_type<PointType>::type Unit;
  Unit x_coord(x(point));
  Unit y_coord(y(point));
  transform.transform(x_coord, y_coord);
  x(point, x_coord);
  y(point, y_coord);
  return point;
}
Exemple #2
0
typename enable_if<
  typename gtl_and<
    y_pt_scale,
    typename is_mutable_point_concept<
      typename geometry_concept<PointType>::type
    >::type
  >::type,
PointType>::type& scale(PointType& point, const ScaleType& scaling) {
  typedef typename point_coordinate_type<PointType>::type Unit;
  Unit x_coord(x(point));
  Unit y_coord(y(point));
  scaling.scale(x_coord, y_coord);
  x(point, x_coord);
  y(point, y_coord);
  return point;
}
Exemple #3
0
void grid::output(const output_list_type& olists, std::string _filename, real _t, int cycle, bool analytic) {
#ifdef DO_OUTPUT

	std::thread(
		[&](const std::string& filename, real t) {
			printf( "t = %e\n", t);
			const std::set<node_point>& node_list = olists.nodes;
			const std::vector<zone_int_type>& zone_list = olists.zones;

			const int nzones = zone_list.size() / NVERTEX;
			std::vector<int> zone_nodes;
			zone_nodes = std::move(zone_list);

			const int nnodes = node_list.size();
			std::vector<double> x_coord(nnodes);
			std::vector<double> y_coord(nnodes);
			std::vector<double> z_coord(nnodes);
			std::array<double*, NDIM> node_coords = {x_coord.data(), y_coord.data(), z_coord.data()};
			for (auto iter = node_list.begin(); iter != node_list.end(); ++iter) {
				const integer i = iter->index;
				x_coord[i] = iter->pt[0];
				y_coord[i] = iter->pt[1];
				z_coord[i] = iter->pt[2];
			}

			constexpr
			int nshapes = 1;
			int shapesize[1] = {NVERTEX};
			int shapetype[1] = {DB_ZONETYPE_HEX};
			int shapecnt[1] = {nzones};
			const char* coord_names[NDIM] = {"x", "y", "z"};

#ifndef	__MIC__
		auto olist = DBMakeOptlist(1);
		double time = double(t);
		int ndim = 3;
		DBAddOption(olist, DBOPT_CYCLE, &cycle);
		DBAddOption(olist, DBOPT_DTIME, &time);
		DBAddOption(olist, DBOPT_NSPACE, &ndim );
		DBfile *db = DBCreateReal(filename.c_str(), DB_CLOBBER, DB_LOCAL, "Euler Mesh", DB_PDB);
		assert(db);
		DBPutZonelist2(db, "zones", nzones, int(NDIM), zone_nodes.data(), nzones * NVERTEX, 0, 0, 0, shapetype, shapesize,
			shapecnt, nshapes, olist);
		DBPutUcdmesh(db, "mesh", int(NDIM), const_cast<char**>(coord_names), node_coords.data(), nnodes, nzones, "zones", nullptr, DB_DOUBLE,
			olist);
		const char* analytic_names[] = {"rho_a", "egas_a", "sx_a", "sy_a", "sz_a", "tau_a"};
		DBFreeOptlist(olist);
		for (int field = 0; field != NF + NGF + NPF; ++field) {
			auto olist = DBMakeOptlist(1);
			double time = double(t);
			int istrue = 1;
			int isfalse = 0;
			DBAddOption(olist, DBOPT_CYCLE, &cycle);
			DBAddOption(olist, DBOPT_DTIME, &time);
			DBAddOption(olist, DBOPT_NSPACE, &ndim );
			if( field == rho_i || field == sx_i || field == sy_i || field == sz_i || field == spc_ac_i || field == spc_ae_i || field == spc_dc_i || field == spc_de_i || field == spc_vac_i ) {
				DBAddOption(olist, DBOPT_CONSERVED, &istrue);
			} else {
				DBAddOption(olist, DBOPT_CONSERVED, &isfalse );
			}
			if( field < NF ) {
				DBAddOption(olist, DBOPT_EXTENSIVE, &istrue);
			} else {
				DBAddOption(olist, DBOPT_EXTENSIVE, &isfalse);
			}
			DBAddOption(olist, DBOPT_EXTENSIVE, &istrue);
			DBPutUcdvar1(db, field_names[field], "mesh", const_cast<void*>(reinterpret_cast<const void*>(olists.data[field].data())), nzones, nullptr, 0, DB_DOUBLE, DB_ZONECENT,
				olist);
			if( analytic && field < 6) {
				DBPutUcdvar1(db, analytic_names[field], "mesh", const_cast<void*>(reinterpret_cast<const void*>(olists.analytic[field].data())), nzones, nullptr, 0, DB_DOUBLE, DB_ZONECENT,
					olist);
			}
			DBFreeOptlist(olist);
#ifdef RHO_ONLY
		break;
#endif
	}
	DBClose(db);
#endif
	}, _filename, _t).join();
#endif
}