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


C++ dump函数代码示例

本文整理汇总了C++中dump函数的典型用法代码示例。如果您正苦于以下问题:C++ dump函数的具体用法?C++ dump怎么用?C++ dump使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: mc

////////////////////////////////////////////////////////////////////////////////
/// @brief 動き補償 (小ブロック単位)
///
/// TODO: メモリアクセスの出力
///
/// @param SF  [in] 画素差分データ
/// @param b   [in] ブロック番号
///
int mc(int SF[8][8], int b)
{
	int p[8][8];
	int mixf = 1 - (fptr[0][mb_y][mb_x] & 1);

	if(pic_coding_type == 1) mixf = 0;

	dump_header(dump_mv);
	dump(dump_mv, "mbx mby intra pat", " %2d %2d %d %d",
			mb_x, mb_y, mb_intra, (mb_pattern >> (5 - b)) & 1);

	if(!mb_mo_fw) mv[0][0][0] = mv[0][0][1] = 0;

	if(mb_intra)
	{
		dumpx_mc_fetch("# no fetch (mb_intra=1)\n");
	}
	else
	{
		uint32_t fetch_a[9][5];
		uint8_t fetch_d[9][10];

		int ivx = mv[0][0][0];
		int ivy = mv[0][0][1];
		dump(dump_mv, "mvx mvy", " %5d %5d", ivx, ivy);

		if(b & 4) { ivx /= 2; ivy /= 2; }	// 絶対値の小さい方へ丸め
		int halfx = ivx & 1;
		int halfy = ivy & 1;
		ivx = (ivx & ~1) / 2;
		ivy = (ivy & ~1) / 2;
		int oddx = ivx & 1;

		dump(dump_mv, "ivx halfx", " %3d %d", ivx, halfx);
		dump(dump_mv, "ivy halfy", " %3d %d", ivy, halfy);

		ivx += (b < 4) ? (mb_x * 16 + (b & 1) * 8) : (mb_x * 8);
		ivy += (b < 4) ? (mb_y * 16 + (b & 2) * 4) : (mb_y * 8);
		dump(dump_mv, "ox oy", " %3d %3d", ivx, ivy);

		dumpx_mc_fetch("# ivx=%d,halfx=%d,ivy=%d,halfy=%d\n",
			ivx, halfx, ivy, halfy);

		// フェッチアドレス計算
		if(b < 4)
		{
			for(int y = 0; y < 9; ++y) for(int x = 0; x < 10; x += 2)
			{
				int ivx2 = x + ivx;
				int ivy2 = y + ivy;
				int f = fptr[0][(ivy2 >> 4) & MBY_MASK][(ivx2 >> 4) & MBX_MASK] & 1;
				fetch_a[y][x >> 1] =
					FBAGEN(b, f, (ivx2 >> 4), (ivx2 & 14) >> 1, (ivy2 >> 4), (ivy2 & 15));
			}
		}
		else
		{
			for(int y = 0; y < 9; ++y) for(int x = 0; x < 10; x += 2)
			{
				int ivx2 = x + ivx;
				int ivy2 = y + ivy;
				int f = fptr[0][(ivy2 >> 3) & MBY_MASK][(ivx2 >> 3) & MBX_MASK] & 1;
				fetch_a[y][x >> 1] =
					FBAGEN(b, f, (ivx2 >> 3), (ivx2 & 14), (ivy2 >> 3), (ivy2 & 7) << 1);
			}
		}

		// フェッチ実行
		for(int y = 0; y < 9; ++y) for(int x = 0; x < 10; x += 2)
		{
			uint32_t a = fetch_a[y][x >> 1];
			fetch_d[y][x + 0] = fbuf[a + 0];
			fetch_d[y][x + 1] = fbuf[a + 1];
			dumpx_mc_fetch("%06x %02x%02x\n",
				fetch_a[y][x >> 1], fetch_d[y][x + 1], fetch_d[y][x + 0]);
		}

		// 整数画素・半画素合成
		for(int y = 0; y < 8; ++y) for(int x = 0; x < 8; ++x)
		{
			int ym = y + halfy;
			p[y][x] = (fetch_d[y][x + oddx] + fetch_d[y][x + oddx + halfx] +
						fetch_d[ym][x + oddx] + fetch_d[ym][x + oddx + halfx] + 2) / 4;

			dumpx_mc_fetch("%s %2x%s",
				x == 0 ? "#" : "", p[y][x], x == 7 ? "\n" : "");
		}
		dumpx_mc_fetch("#------------------------\n");
		// memset(p, 0, sizeof(p));
	}
开发者ID:kimushu,项目名称:m2v_dec_eval,代码行数:98,代码来源:mc.c

示例2: main

int main(int argc, char **argv)
{
	enum {
		NNP = CHAR_MAX + 1,
		RUID,
		EUID,
		RGID,
		EGID,
		REUID,
		REGID,
		CLEAR_GROUPS,
		KEEP_GROUPS,
		INIT_GROUPS,
		GROUPS,
		INHCAPS,
		AMBCAPS,
		LISTCAPS,
		CAPBSET,
		SECUREBITS,
		PDEATHSIG,
		SELINUX_LABEL,
		APPARMOR_PROFILE
	};

	static const struct option longopts[] = {
		{ "dump",             no_argument,       NULL, 'd'              },
		{ "nnp",              no_argument,       NULL, NNP              },
		{ "no-new-privs",     no_argument,       NULL, NNP              },
		{ "inh-caps",         required_argument, NULL, INHCAPS          },
		{ "ambient-caps",     required_argument, NULL, AMBCAPS          },
		{ "list-caps",        no_argument,       NULL, LISTCAPS         },
		{ "ruid",             required_argument, NULL, RUID             },
		{ "euid",             required_argument, NULL, EUID             },
		{ "rgid",             required_argument, NULL, RGID             },
		{ "egid",             required_argument, NULL, EGID             },
		{ "reuid",            required_argument, NULL, REUID            },
		{ "regid",            required_argument, NULL, REGID            },
		{ "clear-groups",     no_argument,       NULL, CLEAR_GROUPS     },
		{ "keep-groups",      no_argument,       NULL, KEEP_GROUPS      },
		{ "init-groups",      no_argument,       NULL, INIT_GROUPS      },
		{ "groups",           required_argument, NULL, GROUPS           },
		{ "bounding-set",     required_argument, NULL, CAPBSET          },
		{ "securebits",       required_argument, NULL, SECUREBITS       },
		{ "pdeathsig",        required_argument, NULL, PDEATHSIG,       },
		{ "selinux-label",    required_argument, NULL, SELINUX_LABEL    },
		{ "apparmor-profile", required_argument, NULL, APPARMOR_PROFILE },
		{ "help",             no_argument,       NULL, 'h'              },
		{ "version",          no_argument,       NULL, 'V'              },
		{ NULL, 0, NULL, 0 }
	};

	static const ul_excl_t excl[] = {
		/* keep in same order with enum definitions */
		{CLEAR_GROUPS, KEEP_GROUPS, INIT_GROUPS, GROUPS},
		{0}
	};
	int excl_st[ARRAY_SIZE(excl)] = UL_EXCL_STATUS_INIT;

	int c;
	struct privctx opts;
	struct passwd *pw = NULL;
	int dumplevel = 0;
	int total_opts = 0;
	int list_caps = 0;

	setlocale(LC_ALL, "");
	bindtextdomain(PACKAGE, LOCALEDIR);
	textdomain(PACKAGE);
	atexit(close_stdout);

	memset(&opts, 0, sizeof(opts));

	while ((c = getopt_long(argc, argv, "+dhV", longopts, NULL)) != -1) {
		err_exclusive_options(c, longopts, excl, excl_st);
		total_opts++;
		switch (c) {
		case 'd':
			dumplevel++;
			break;
		case NNP:
			if (opts.nnp)
				errx(EXIT_FAILURE,
				     _("duplicate --no-new-privs option"));
			opts.nnp = 1;
			break;
		case RUID:
			if (opts.have_ruid)
				errx(EXIT_FAILURE, _("duplicate ruid"));
			opts.have_ruid = 1;
			pw = get_passwd(optarg, &opts.ruid, _("failed to parse ruid"));
			if (pw) {
				passwd_copy(&opts.passwd, pw);
				opts.have_passwd = 1;
			}
			break;
		case EUID:
			if (opts.have_euid)
				errx(EXIT_FAILURE, _("duplicate euid"));
			opts.have_euid = 1;
			opts.euid = get_user(optarg, _("failed to parse euid"));
//.........这里部分代码省略.........
开发者ID:Webster-WXH,项目名称:util-linux,代码行数:101,代码来源:setpriv.c

示例3: insert

bool ConfigManager::initialize()
{
  if (isInitialized())
  {
    std::cerr << "CONFIG WARNING: The configuration framework is already initialized!" << std::endl;
    return true;
  }

  if (Getopt::instance().paramOptPresent("configfile"))
  {
    // Read the configuration file.
    icl_core::String filename = Getopt::instance().paramOpt("configfile");
    if (!load(filename))
    {
      std::cerr << "CONFIG ERROR: The configuration file '" << filename << "' could not be loaded!"
          << std::endl;
      return false;
    }
    insert(CONFIGFILE_CONFIG_KEY, filename);
    notify(CONFIGFILE_CONFIG_KEY);
  }

  // Check for registered parameters.
  for (ConfigParameterList::const_iterator it = m_parameter_list.begin(); it != m_parameter_list.end(); ++it)
  {
    if (it->configKey() != "")
    {
      // Fill the configuration parameter from the commandline.
      if (Getopt::instance().paramOptPresent(it->option()))
      {
        insert(it->configKey(), Getopt::instance().paramOpt(it->option()));
        notify(it->configKey());
      }
      // If the parameter is still not present but has a default value, then set it.
      else if (!hasKey(it->configKey()) && it->hasDefaultValue())
      {
          insert(it->configKey(), it->defaultValue());
          notify(it->configKey());
      }
    }
  }

  // Check for registered positional parameters.
  for (ConfigPositionalParameterList::const_iterator it = m_postional_parameter_list.begin(); it != m_postional_parameter_list.end(); ++it)
  {
    if (it->configKey() != "")
    {
      // Fill the configuration parameter from the commandline.
      if (Getopt::instance().paramOptPresent(it->name()))
      {
        insert(it->configKey(), Getopt::instance().paramOpt(it->name()));
        notify(it->configKey());
      }
      // If the parameter is still not present but has a default value, then set it.
      else if (!hasKey(it->configKey()) && it->hasDefaultValue())
      {
          insert(it->configKey(), it->defaultValue());
          notify(it->configKey());
      }
    }
  }

  // Check for option parameters.
  Getopt::KeyValueList option_params = Getopt::instance().paramPrefixOpt("config-option");
  for (Getopt::KeyValueList::const_iterator it = option_params.begin(); it != option_params.end(); ++it)
  {
    insert(it->m_key, it->m_value);
    notify(it->m_key);
  }

  // Optionally dump the configuration.
  if (Getopt::instance().paramOptPresent("dump-config"))
  {
    dump();
  }

  m_initialized = true;
  return true;
}
开发者ID:HumaRobotics,项目名称:fzi_icl_core,代码行数:79,代码来源:ConfigManager.cpp

示例4: dump

void ConsumerBase::dump(String8& result) const {
    char buffer[1024];
    dump(result, "", buffer, 1024);
}
开发者ID:Proshivalskiy,项目名称:MT6582_kernel_source,代码行数:4,代码来源:ConsumerBase.cpp

示例5: toString

 string toString() { ostringstream oss; dump(oss); return oss.str(); }
开发者ID:jterweeme,项目名称:wincore,代码行数:1,代码来源:dd.cpp

示例6: switch

void AsiMS2000::selectCommand(int commandNum)
{
  switch(commandNum)
  {
      case 0:
          accel();
          break;
      case 1:
          aalign();
          break;
      case 2:
          afcont();
          break;
      case 3:
          aflim();
          break;
      case 4:
          afocus();
          break;
      case 5:
          afset();
          break;
      case 6:
          afmove();
          break;
      case 7:
          ahome();
          break;
      case 8:
          aij();
          break;
      case 9:
          array();
          break;
      case 10:
          azero();
          break;
      case 11:
          backlash();
          break;
      case 12:
          bcustom();
          break;
      case 13:
          benable();
          break;
      case 14:
          build();
          break;
      case 15:
          cdate();
          break;
      case 16:
          cnts();
          break;
      case 17:
          customa();
          break;
      case 18:
          customb();
          break;
      case 19:
          dack();
          break;
      case 20:
          dump();
          break;
      case 21:
          ensync();
          break;
      case 22:
          epolarity();
          break;
      case 23:
          error();
          break;
      case 24:
          halt();
          break;
      case 25:
          here();
          break;
      case 26:
          home();
          break;
      case 27:
          info();
          break;
      case 28:
          joystick();
          break;
      case 29:
          jsspd();
          break;
      case 30:
          kadc();
          break;
      case 31:
          kd();
          break;
//.........这里部分代码省略.........
开发者ID:AllenBurnham,项目名称:microscope,代码行数:101,代码来源:AsiMS2000.cpp

示例7: main

int main (void)
{
  struct R1 A1 = My_R1;
  struct R2 A2 = My_R2;

  struct Nested1 N1;
  struct Nested2 N2;

  unsigned C1;
  unsigned C2;
  unsigned C3;

  put ("A1 :");
  dump (&A1, sizeof (struct R1));
  new_line ();
  /* { dg-output "A1 : c2 7b f3 2a 5e 12 9a 95\n" } */

  put ("A2 :");
  dump (&A2, sizeof (struct R2));
  new_line ();
  /* { dg-output "A2 : 09 e2 af 37 bd 24 d2 b4\n" } */

  N1 = A1.N;
  C1 = N1.C1;
  C2 = N1.C2;
  C3 = N1.C3;

  printf ("C1 : %d\n", C1);
  /* { dg-output "C1 : 18\n" } */

  printf ("C2 : %d\n", C2);
  /* { dg-output "C2 : 52\n" } */

  printf ("C3 : %d\n", C3);
  /* { dg-output "C3 : 86\n" } */

  N1.C1 = C1;
  N1.C2 = C2;
  N1.C3 = C3;
  A1.N = N1;

  N2 = A2.N;
  C1 = N2.C1;
  C2 = N2.C2;
  C3 = N2.C3;

  printf ("C1 : %d\n", C1);
  /* { dg-output "C1 : 18\n" } */

  printf ("C2 : %d\n", C2);
  /* { dg-output "C2 : 52\n" } */

  printf ("C3 : %d\n", C3);
  /* { dg-output "C3 : 86\n" } */

  N2.C1 = C1;
  N2.C2 = C2;
  N2.C3 = C3;
  A2.N = N2;

  put ("A1 :");
  dump (&A1, sizeof (struct R1));
  new_line ();
  /* { dg-output "A1 : c2 7b f3 2a 5e 12 9a 95\n" } */

  put ("A2 :");
  dump (&A2, sizeof (struct R2));
  new_line ();
  /* { dg-output "A2 : 09 e2 af 37 bd 24 d2 b4\n" } */

  return 0;
}
开发者ID:shabesoglu,项目名称:gcc,代码行数:72,代码来源:s3.c

示例8: dump

void SurfaceMediaSource::dump(String8& result) const
{
    char buffer[1024];
    dump(result, "", buffer, 1024);
}
开发者ID:FirefoxSTE,项目名称:android_frameworks_av,代码行数:5,代码来源:SurfaceMediaSource.cpp

示例9: dump

inline void dump(const std::string& str, bool putColon = true)
{
	dump(str.c_str(), str.size(), putColon);
}
开发者ID:herumi,项目名称:msoffice,代码行数:4,代码来源:util.hpp

示例10: main

int main (void)
{
  struct R1 Local_R1;
  struct R2 Local_R2;

  Local_R1.I      = My_R1.I + 1;
  Local_R1.N.A[0] = My_R1.N.A[0] + 1;
  Local_R1.N.A[1] = My_R1.N.A[1] + 1;
  Local_R1.N.A[2] = My_R1.N.A[2] + 1;

  put ("Local_R1 :");
  dump (&Local_R1, sizeof (struct R1));
  new_line ();
  /* { dg-output "Local_R1 : 79 56 34 12 00 ab 00 13 00 cd 00 35 00 ef 00 57.*\n" } */

  Local_R2.I      = My_R2.I + 1;
  Local_R2.N.A[0] = My_R2.N.A[0] + 1;
  Local_R2.N.A[1] = My_R2.N.A[1] + 1;
  Local_R2.N.A[2] = My_R2.N.A[2] + 1;

  put ("Local_R2 :");
  dump (&Local_R2, sizeof (struct R2));
  new_line ();
  /* { dg-output "Local_R2 : 12 34 56 79 13 00 ab 00 35 00 cd 00 57 00 ef 00.*\n" } */

  Local_R1.I      = 0x12345678;
  Local_R1.N.A[0] = 0xAB0012;
  Local_R1.N.A[1] = 0xCD0034;
  Local_R1.N.A[2] = 0xEF0056;
  put ("Local_R1 :");
  dump (&Local_R1, sizeof (struct R1));
  new_line ();
  /* { dg-output "Local_R1 : 78 56 34 12 00 ab 00 12 00 cd 00 34 00 ef 00 56.*\n" } */

  Local_R2.I      = 0x12345678;
  Local_R2.N.A[0] = 0xAB0012;
  Local_R2.N.A[1] = 0xCD0034;
  Local_R2.N.A[2] = 0xEF0056;
  put ("Local_R2 :");
  dump (&Local_R2, sizeof (struct R2));
  new_line ();
  /* { dg-output "Local_R2 : 12 34 56 78 12 00 ab 00 34 00 cd 00 56 00 ef 00.*\n" } */

  Local_R1.I      = Local_R1.I + 1;
  Local_R1.N.A[0] = Local_R1.N.A[0] + 1;
  Local_R1.N.A[1] = Local_R1.N.A[1] + 1;
  Local_R1.N.A[2] = Local_R1.N.A[2] + 1;

  put ("Local_R1 :");
  dump (&Local_R1, sizeof (struct R1));
  new_line ();
  /* { dg-output "Local_R1 : 79 56 34 12 00 ab 00 13 00 cd 00 35 00 ef 00 57.*\n" } */

  Local_R2.I      = Local_R2.I + 1;
  Local_R2.N.A[0] = Local_R2.N.A[0] + 1;
  Local_R2.N.A[1] = Local_R2.N.A[1] + 1;
  Local_R2.N.A[2] = Local_R2.N.A[2] + 1;

  put ("Local_R2 :");
  dump (&Local_R2, sizeof (struct R2));
  new_line ();
  /* { dg-output "Local_R2 : 12 34 56 79 13 00 ab 00 35 00 cd 00 57 00 ef 00.*\n" } */

  return 0;
}
开发者ID:pjump,项目名称:gcc,代码行数:65,代码来源:t6.c

示例11: dump

void shader::dump_ir() {
	if (ctx.dump_pass)
		dump(*this).run();
}
开发者ID:DirectFB,项目名称:mesa,代码行数:4,代码来源:sb_shader.cpp

示例12: main

int
main(int argc, char **argv)
{
	int ch, mode = 0;
	char *arg = NULL;

	pid = getpid();
	thiszone = gmt2local(0);
	while ((ch = getopt(argc, argv, "acd:f:Ii:nprstA:HPR")) != -1)
		switch (ch) {
		case 'a':
		case 'c':
		case 'p':
		case 'r':
		case 'H':
		case 'P':
		case 'R':
		case 's':
		case 'I':
			if (mode) {
				usage();
				/*NOTREACHED*/
			}
			mode = ch;
			arg = NULL;
			break;
		case 'f':
			exit(file(optarg) ? 1 : 0);
		case 'd':
		case 'i':
			if (mode) {
				usage();
				/*NOTREACHED*/
			}
			mode = ch;
			arg = optarg;
			break;
		case 'n':
			nflag = 1;
			break;
		case 't':
			tflag = 1;
			break;
		case 'A':
			if (mode) {
				usage();
				/*NOTREACHED*/
			}
			mode = 'a';
			repeat = atoi(optarg);
			if (repeat < 0) {
				usage();
				/*NOTREACHED*/
			}
			break;
		default:
			usage();
		}

	argc -= optind;
	argv += optind;

	switch (mode) {
	case 'a':
	case 'c':
		if (argc != 0) {
			usage();
			/*NOTREACHED*/
		}
		dump(0, mode == 'c');
		break;
	case 'd':
		if (argc != 0) {
			usage();
			/*NOTREACHED*/
		}
		delete(arg);
		break;
	case 'I':
#ifdef SIOCSDEFIFACE_IN6	/* XXX: check SIOCGDEFIFACE_IN6 as well? */
		if (argc > 1) {
			usage();
			/*NOTREACHED*/
		} else if (argc == 1) {
			if (strcmp(*argv, "delete") == 0 ||
			    if_nametoindex(*argv))
				setdefif(*argv);
			else
				errx(1, "invalid interface %s", *argv);
		}
		getdefif(); /* always call it to print the result */
		break;
#else
		errx(1, "not supported yet");
		/*NOTREACHED*/
#endif
	case 'p':
		if (argc != 0) {
			usage();
			/*NOTREACHED*/
//.........这里部分代码省略.........
开发者ID:hmatyschok,项目名称:MeshBSD,代码行数:101,代码来源:ndp.c

示例13: main


//.........这里部分代码省略.........
  //infunc.push_back(0.01,new TestFunc(2,1,1));
  //infunc.push_back(0.01,new TestFunc(2,2,1));
  //infunc.push_back(0.001,new TestFunc(2,1,2));
  //infunc.push_back(0.001,new TestFunc(2,2,2));
  //infunc.push_back(0.001,new TestFunc(5,5,5));
  //infunc.push_back(-0.3,new TestFunc(7,2,3));
  //infunc.push_back(0.01,new TestFunc(7,7,7));
  //infunc.push_back(0.001,new TestFunc(5,5,5));

  //Write to an array
  std::vector<double> inData(npts[0]*npts[1]*npts[2]);
  std::vector<double>::iterator it(inData.begin());

  Pooma::Clock timer;
  timer.start();
  //Assign the values
  for(int ix=0; ix<npts[0]; ix++) {
    double x(gridX(ix));
    for(int iy=0; iy<npts[1]; iy++) {
      double y(gridY(iy));
      for(int iz=0; iz<npts[2]; iz++) {
        (*it)=infunc.f(x,y,gridZ(iz));++it;
      }
    }
  }
  timer.stop();
  cout << "Time to evaluate " << timer.cpu_time() << endl;


  //Test TriCubicSplineT function
  //Create XYZCubicGrid
  XYZCubicGrid<double> grid3(&gridX,&gridY,&gridZ);
  //Create a TriCubicSpline with PBC: have to think more about fixed-boundary conditions
  TriCubicSplineT<double> aorb(&grid3);

  //Reset the coefficients
  aorb.reset(inData.begin(), inData.end());

  double lap,val;
  TinyVector<double,3> grad;

  //aorb.reset();
  //Write for vtk ImageData
  string fname("spline3d.vti");
  std::ofstream dfile(fname.c_str());
  dfile.setf(ios::scientific, ios::floatfield);
  dfile.setf(ios::left,ios::adjustfield);
  dfile.precision(10);

  dfile << "<?xml version=\"1.0\"?>" << endl;
  dfile << "<VTKFile type=\"ImageData\" version=\"0.1\">" << endl;
  dfile << "  <ImageData WholeExtent=\"0 " << npts[0]-2 << " 0 " << npts[1]-2 << " 0 " << npts[2]-2 
    << "\" Origin=\"0 0 0\" Spacing=\"1 1 1\">"<< endl;
  dfile << "    <Piece Extent=\"0 " << npts[0]-2 << " 0 " << npts[1]-2 << " 0 " << npts[2]-2 << "\">" << endl;
  dfile << "       <PointData Scalars=\"wfs\">" << endl;
  dfile << "          <DataArray type=\"Float32\" Name=\"wfs\">" << endl;
  timer.start();
  int ng=0;
  for(int ix=0; ix<npts[0]-1; ix++) {
    double x(gridX(ix));
    for(int iy=0; iy<npts[1]-1; iy++) {
      double y(gridY(iy));
      for(int iz=0; iz<npts[2]-1; iz++, ng++) {
         TinyVector<double,3> p(x,y,gridZ(iz));
         //aorb.setgrid(p);
         //Timing with the ofstream is not correct. 
         //Uncomment the line below and comment out the next two line.
         //double t=aorb.evaluate(p,grad,lap);
         dfile << setw(20) << aorb.evaluate(p,grad,lap);
         if(ng%5 == 4) dfile << endl;
      }
    }
  }
  timer.stop();
  cout << "Time to evaluate with spline " << timer.cpu_time() << endl;
  dfile << "          </DataArray>" << endl;
  dfile << "       </PointData>" << endl;
  dfile << "    </Piece>" << endl;
  dfile << "  </ImageData>" << endl;
  dfile << "</VTKFile>" << endl;

  hid_t h_file = H5Fcreate("spline3d.h5",H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT);
  HDFAttribIO<std::vector<double> > dump(inData,npts);
  dump.write(h_file,"orb0000");
  HDFAttribIO<TriCubicSplineT<double> > dump1(aorb);
  dump1.write(h_file,"spline0000");
  H5Fclose(h_file);

  //double lap;
  //TinyVector<double,3> grad;
  //for(int k=0; k<nptY-1; k++) {
  //  //TinyVector<double,3> p(xcut,ycut,gridZ(k)+0.11*gridZ.dr(k));
  //  TinyVector<double,3> p(xcut,gridY(k)+0.11*gridY.dr(k),ycut);
  //  aorb.setgrid(p);
  //  double y=aorb.evaluate(p,grad,lap);
  //  dfile << setw(30) << p[1] << setw(30) << infunc.f(p) << setw(30) << y << setw(30) << infunc.d2f(p) << setw(30) << lap << endl;
  //}

  return 0;
}
开发者ID:digideskio,项目名称:qmcpack,代码行数:101,代码来源:spline3.cpp

示例14: main

int main(int argc, char **argv){
    // Local variables
    struct sockaddr_in our_addr;
    void               *buf  = NULL;
    int                sock  = -1;
    unsigned int       slen  = 0;
    int                err   = 0;
    int                i;

    // Parse parameters
    while ((i = getopt(argc, argv, "n:s:t:q")) != -1){
        switch(i){
        case 'n': // Number of packets
            npkts = atoi(optarg);
            break;

        case 's': // Payload size
            bufsz = atoi(optarg);
            if (bufsz < sizeof(udpdata_t)){
                fprintf(stderr, "Payload size must be at least %zd bytes\n",
                        sizeof(udpdata_t));
                goto err;
            }
            break;

	case 't': // Tolerance timer duration
	    toler_sec = atoi(optarg);
	    break;

	case 'q': // Suppress per-packet output
	    suppress_dump = 1;
	    break;

        default:
            usage(argv[0]);
            goto err;
        }
    }

    // Initialise timer
    timer_init();

    // Allocate receive buffer
    if ((udpdata = (udpdata_t *)calloc(npkts, sizeof(*udpdata))) == NULL)
    {
        perror("calloc");
        goto err;
    }
    if ((buf = malloc(bufsz)) == NULL){
        perror("malloc");
        goto err;
    }

    // Handles kill
    signal(SIGINT, sigterm_h);

    // Handles timer
    signal(SIGALRM, sigalrm_h);

    // Setup UDP socket
    if ((sock = socket(AF_INET, SOCK_DGRAM, 0)) < 0){
        perror("socket");
        fprintf(stderr, "Error creating temporary socket.\n");
        goto err;
    }
    memset(&our_addr, 0, sizeof(our_addr));
    our_addr.sin_family      = AF_INET;
    our_addr.sin_addr.s_addr = INADDR_ANY;
    our_addr.sin_port        = htons(UDPPORT);
    if (bind(sock, (struct sockaddr *)&our_addr, sizeof(struct sockaddr)) < 0){
        perror("bind");
        goto err;
    }

    // Receive packets
    for (i=0; i<npkts; i++){
        slen = sizeof(struct sockaddr);
        err = recvfrom(sock, buf, bufsz, 0, (struct sockaddr *)&our_addr, &slen);
        if (err < 0){
            perror("recvfrom");
            goto err;
        } else
        if (err != bufsz){
            fprintf(stderr, "Received unknown packet.\n");
            goto err;
        }
        memcpy(&udpdata[i], buf, sizeof(udpdata_t));
        udpdata[i].tscrx = rdtsc();
        timer_reset();
    }

    // Dump
    dump();

out:
    if (sock >= 0)
        close(sock);
    if (buf)
        free(buf);

//.........这里部分代码省略.........
开发者ID:rosslagerwall,项目名称:udpgen,代码行数:101,代码来源:udprx.c

示例15: dump

 std::string dump() const {
     std::string out;
     dump(out);
     return out;
 }
开发者ID:nathanworms,项目名称:ppconsul,代码行数:5,代码来源:json11.hpp


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