• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ pc函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: run

void run( const int N, const int M, const int L, const int hyper_threads, const int vector_lanes,
                  const int nx, const int ny, const int nz, const int ichunk,
                  const int nang, const int noct, const int ng, const int nmom, const int cmom,
                  const vector<diag_c>& diag )
{
  
	typedef typename Kokkos::DefaultExecutionSpace device_t;
	typedef TeamPolicy<device_t> team_policy_t;
	typedef View<double*, device_t> view_1d_t;
	typedef View<double**, Kokkos::LayoutLeft, device_t> view_2d_t;
	typedef View<double***, Kokkos::LayoutLeft, device_t> view_3d_t;
	typedef View<double****, Kokkos::LayoutLeft, device_t> view_4d_t;
	typedef View<double*****, Kokkos::LayoutLeft, device_t> view_5d_t;
	typedef View<double******, Kokkos::LayoutLeft, device_t> view_6d_t;
	typedef View<double*******, Kokkos::LayoutLeft, device_t> view_7d_t;


	int id = 1;
	int ich = 1;
	int jlo = 0;
	int jhi = ny-1;
	int jst = 1;
	int jd = 2;
	int klo = 0;
	int khi = nz-1;
	int kst = 1;
	int kd = 2;
	double hi = c1;
	
	Kokkos::initialize();
	Kokkos::DefaultExecutionSpace::print_configuration(cout);
	
	view_4d_t psii( "psii", nang, ny, nz, ng );
	view_4d_t psij( "psij", nang, ichunk, nz, ng );
	view_4d_t psik( "psik", nang, ichunk, ny, ng );
	view_4d_t jb_in( "jb_in", nang, ichunk, ny, ng ); // jb_in(nang,ichunk,nz,ng)
	view_4d_t kb_in( "kb_in", nang, ichunk, ny, ng ); // kb_in(nang,ichunk,nz,ng)
	view_6d_t qim( "qim", nang, nx, ny, nz, noct, ng ); // qim(nang,nx,ny,nz,noct,ng)
  view_5d_t qtot( "qtot", cmom, nx, ny, nx, ng ); // qtot(cmom,nx,ny,nz,ng)
	view_2d_t ec( "ec", nang, cmom ); // ec(nang,cmom)
	view_1d_t mu( "mu", nang ); // mu(nang)
	view_1d_t w( "w", nang ); // w(nang)
	view_1d_t wmu( "wmu", nang ); // wmu(nang)
	view_1d_t weta( "weta", nang ); // weta(nang)
	view_1d_t wxi( "wxi", nang ); // wxi(nang)
	view_1d_t hj( "hj", nang ); // hj(nang)
	view_1d_t hk( "hk", nang ); // hk(nang)
	view_1d_t vdelt( "vdelt", ng ); // vdelt(ng)
	view_6d_t ptr_in( "ptr_in", nang, nx, ny, nz, noct, ng ); // ptr_in(nang,nx,ny,nz,noct,ng)
	view_6d_t ptr_out( "ptr_out", nang, nx, ny, nz, noct, ng ); // ptr_out(nang,nx,ny,nz,noct,ng)
	view_4d_t flux( "flux", nx, ny, nz, ng ); // flux(nx,ny,nz,ng)
	view_5d_t fluxm( "fluxm", cmom-1, nx, ny, nz, ng ); //fluxm(cmom-1,nx,ny,nz,ng)
	view_2d_t psi( "psi", nang, M );
	view_2d_t pc( "pc", nang, M );
	view_4d_t jb_out( "jb_out", nang, ichunk, nz, ng );
	view_4d_t kb_out( "kb_out", nang, ichunk, ny, ng );
	view_4d_t flkx( "flkx", nx+1, ny, nz, ng );
	view_4d_t flky( "flky", nx, ny+1, nz, ng );
	view_4d_t flkz( "flkz", nx, ny, nz+1, ng );
  view_3d_t hv( "hv", nang, 4, M ); // hv(nang,4,M)
  view_3d_t fxhv( "fxhv", nang, 4, M ); // fxhv(nang,4,M)
  view_5d_t dinv( "dinv", nang, nx, ny, nz, ng ); // dinv(nang,nx,ny,nz,ng)
  view_2d_t den( "den", nang, M ); // den(nang,M)
  view_4d_t t_xs( "t_xs", nx, ny, nz, ng ); // t_xs(nx,ny,nz,ng)
   	  
  const team_policy_t policy( N, hyper_threads, vector_lanes );
  
  for (int ii = 0; ii < n_test_iter; ii++) {
    Kokkos::Impl::Timer timer;
    
    for (int oct = 0; oct < noct; oct++) {
      parallel_for( policy, dim3_sweep2<  team_policy_t,
                                          view_1d_t, view_2d_t, view_3d_t, view_4d_t,
                                          view_5d_t, view_6d_t, view_7d_t >
                                        ( M, L,
                                          ng, cmom, noct,
                                          nx, ny, nz, ichunk,
                                          diag,
                                          id, ich, oct,
                                          jlo, jhi, jst, jd,
                                          klo, khi, kst, kd,
                                          psii, psij, psik,
                                          jb_in, kb_in,
                                          qim, qtot, ec,
                                          mu, w,
                                          wmu, weta, wxi,
                                          hi, hj, hk,
                                          vdelt, ptr_in, ptr_out,
                                          flux, fluxm, psi, pc,
                                          jb_out, kb_out,
                                          flkx, flky, flkz,
                                          hv, fxhv, dinv,
                                          den, t_xs ) );
    }// end noct
    
    std::cout << " ii " << ii << " elapsed time " << timer.seconds() << std::endl;
  } // end n_test_iter	
	
	Kokkos::finalize();
}
开发者ID:GCZhang,项目名称:SNAP,代码行数:100,代码来源:main.cpp


示例2: pc

void
DropDownListClientWKC::hide(WebCore::PopupMenuClient *client)
{
    PopupMenuClientPrivate pc(client);
    m_appClient->hide(&pc.wkc());
}
开发者ID:flying-dutchmen,项目名称:3DS_w3Browser,代码行数:6,代码来源:DropDownListClientWKC.cpp


示例3: main

int main(int argc, char **args) 
{
  // Test variable.
  int success_test = 1;

  if (argc < 2) error("Not enough parameters.");

  // Load the mesh.
	Mesh mesh;
  H3DReader mloader;
  if (!mloader.load(args[1], &mesh)) error("Loading mesh file '%s'.", args[1]);

	// Initialize the space.
	int mx = 2;
	Ord3 order(mx, mx, mx);
	H1Space space(&mesh, bc_types, NULL, order);
#if defined LIN_DIRICHLET || defined NLN_DIRICHLET
	space.set_essential_bc_values(essential_bc_values);
#endif
	// Initialize the weak formulation.
	WeakForm wf;
	wf.add_vector_form(form_0<double, scalar>, form_0<Ord, Ord>);
#if defined LIN_NEUMANN || defined LIN_NEWTON
	wf.add_vector_form_surf(form_0_surf<double, scalar>, form_0_surf<Ord, Ord>);
#endif
#if defined LIN_DIRICHLET || defined NLN_DIRICHLET
	// preconditioner
	wf.add_matrix_form(precond_0_0<double, scalar>, precond_0_0<Ord, Ord>, HERMES_SYM);
#endif

	// Initialize the FE problem.
	DiscreteProblem fep(&wf, &space);

#if defined LIN_DIRICHLET || defined NLN_DIRICHLET
	// use ML preconditioner to speed-up things
	MlPrecond pc("sa");
	pc.set_param("max levels", 6);
	pc.set_param("increasing or decreasing", "decreasing");
	pc.set_param("aggregation: type", "MIS");
	pc.set_param("coarse: type", "Amesos-KLU");
#endif

	NoxSolver solver(&fep);
#if defined LIN_DIRICHLET || defined NLN_DIRICHLET
//	solver.set_precond(&pc);
#endif

	info("Solving.");
	Solution sln(&mesh);
	if(solver.solve()) Solution::vector_to_solution(solver.get_solution(), &space, &sln);
  else error ("Matrix solver failed.\n");
	

		Solution ex_sln(&mesh);
		ex_sln.set_exact(exact_solution);

		// Calculate exact error.
  info("Calculating exact error.");
  Adapt *adaptivity = new Adapt(&space, HERMES_H1_NORM);
  bool solutions_for_adapt = false;
  double err_exact = adaptivity->calc_err_exact(&sln, &ex_sln, solutions_for_adapt, HERMES_TOTAL_ERROR_ABS);

  if (err_exact > EPS)
		// Calculated solution is not precise enough.
		success_test = 0;

  if (success_test) {
    info("Success!");
    return ERR_SUCCESS;
  }
  else {
    info("Failure!");
    return ERR_FAILURE;
  }
}
开发者ID:B-Rich,项目名称:hermes-legacy,代码行数:75,代码来源:main.cpp


示例4: countPaths

std::string countPaths(S& spec, bool fast = false) {
    PathCounter<S> pc(spec);
    return fast ? pc.countFast() : pc.count();
}
开发者ID:K-Sonoda,项目名称:graphillion,代码行数:4,代码来源:PathCounter.hpp


示例5: is_interpreted_frame

bool frame::is_interpreted_frame() const  {
  return Interpreter::contains(pc());
}
开发者ID:ericbbcc,项目名称:hotspot,代码行数:3,代码来源:frame_sparc.cpp


示例6: approxSurface

    Py::Object approxSurface(const Py::Tuple& args, const Py::Dict& kwds)
    {
        PyObject *o;
        // spline parameters
        int uDegree = 3;
        int vDegree = 3;
        int uPoles = 6;
        int vPoles = 6;
        // smoothing
        PyObject* smooth = Py_True;
        double weight = 0.1;
        double grad = 1.0;  //0.5
        double bend = 0.0; //0.2
        // other parameters
        int iteration = 5;
        PyObject* correction = Py_True;
        double factor = 1.0;

        static char* kwds_approx[] = {"Points", "UDegree", "VDegree", "NbUPoles", "NbVPoles",
                                      "Smooth", "Weight", "Grad", "Bend",
                                      "Iterations", "Correction", "PatchFactor", NULL};
        if (!PyArg_ParseTupleAndKeywords(args.ptr(), kwds.ptr(), "O|iiiiO!dddiO!d",kwds_approx,
                                        &o,&uDegree,&vDegree,&uPoles,&vPoles,
                                        &PyBool_Type,&smooth,&weight,&grad,&bend,
                                        &iteration,&PyBool_Type,&correction,&factor))
            throw Py::Exception();

        double curvdiv = 1.0 - (grad + bend);
        int uOrder = uDegree + 1;
        int vOrder = vDegree + 1;

        // error checking
        if (grad < 0.0 || grad > 1.0) {
            throw Py::ValueError("Value of Grad out of range [0,1]");
        }
        if (bend < 0.0 || bend > 1.0) {
            throw Py::ValueError("Value of Bend out of range [0,1]");
        }
        if (curvdiv < 0.0 || curvdiv > 1.0) {
            throw Py::ValueError("Sum of Grad and Bend out of range [0,1]");
        }
        if (uDegree < 1 || uOrder > uPoles) {
            throw Py::ValueError("Value of uDegree out of range [1,NbUPoles-1]");
        }
        if (vDegree < 1 || vOrder > vPoles) {
            throw Py::ValueError("Value of vDegree out of range [1,NbVPoles-1]");
        }

        try {
            Py::Sequence l(o);
            TColgp_Array1OfPnt clPoints(0, l.size()-1);
            if (clPoints.Length() < uPoles * vPoles) {
                throw Py::ValueError("Too less data points for the specified number of poles");
            }

            int index=0;
            for (Py::Sequence::iterator it = l.begin(); it != l.end(); ++it) {
                Py::Tuple t(*it);
                clPoints(index++) = gp_Pnt(
                    (double)Py::Float(t.getItem(0)),
                    (double)Py::Float(t.getItem(1)),
                    (double)Py::Float(t.getItem(2)));
            }

            Reen::BSplineParameterCorrection pc(uOrder,vOrder,uPoles,vPoles);
            Handle_Geom_BSplineSurface hSurf;

            pc.EnableSmoothing(PyObject_IsTrue(smooth) ? true : false, weight, grad, bend, curvdiv);
            hSurf = pc.CreateSurface(clPoints, iteration, PyObject_IsTrue(correction) ? true : false, factor);
            if (!hSurf.IsNull()) {
                return Py::asObject(new Part::BSplineSurfacePy(new Part::GeomBSplineSurface(hSurf)));
            }

            throw Py::RuntimeError("Computation of B-Spline surface failed");
        }
        catch (Standard_Failure &e) {
            std::string str;
            Standard_CString msg = e.GetMessageString();
            str += typeid(e).name();
            str += " ";
            if (msg) {str += msg;}
            else     {str += "No OCCT Exception Message";}
            throw Py::RuntimeError(str);
        }
        catch (const Base::Exception &e) {
            throw Py::RuntimeError(e.what());
        }
        catch (...) {
            throw Py::RuntimeError("Unknown C++ exception");
        }
    }
开发者ID:plaes,项目名称:FreeCAD,代码行数:91,代码来源:AppReverseEngineering.cpp


示例7: code_section

void MacroAssembler::store_oop(jobject obj) {
  code_section()->relocate(pc(), oop_Relocation::spec_for_immediate());
  emit_address((address) obj);
}
开发者ID:campolake,项目名称:openjdk9,代码行数:4,代码来源:assembler_zero.cpp


示例8: pc

address InterpreterGenerator::generate_math_entry(AbstractInterpreter::MethodKind kind) {

  // rbx,: Method*
  // rcx: scratrch
  // r13: sender sp

  if (!InlineIntrinsics) return NULL; // Generate a vanilla entry

  address entry_point = __ pc();

  // These don't need a safepoint check because they aren't virtually
  // callable. We won't enter these intrinsics from compiled code.
  // If in the future we added an intrinsic which was virtually callable
  // we'd have to worry about how to safepoint so that this code is used.

  // mathematical functions inlined by compiler
  // (interpreter must provide identical implementation
  // in order to avoid monotonicity bugs when switching
  // from interpreter to compiler in the middle of some
  // computation)
  //
  // stack: [ ret adr ] <-- rsp
  //        [ lo(arg) ]
  //        [ hi(arg) ]
  //

  // Note: For JDK 1.2 StrictMath doesn't exist and Math.sin/cos/sqrt are
  //       native methods. Interpreter::method_kind(...) does a check for
  //       native methods first before checking for intrinsic methods and
  //       thus will never select this entry point. Make sure it is not
  //       called accidentally since the SharedRuntime entry points will
  //       not work for JDK 1.2.
  //
  // We no longer need to check for JDK 1.2 since it's EOL'ed.
  // The following check existed in pre 1.6 implementation,
  //    if (Universe::is_jdk12x_version()) {
  //      __ should_not_reach_here();
  //    }
  // Universe::is_jdk12x_version() always returns false since
  // the JDK version is not yet determined when this method is called.
  // This method is called during interpreter_init() whereas
  // JDK version is only determined when universe2_init() is called.

  // Note: For JDK 1.3 StrictMath exists and Math.sin/cos/sqrt are
  //       java methods.  Interpreter::method_kind(...) will select
  //       this entry point for the corresponding methods in JDK 1.3.
  // get argument

  if (kind == Interpreter::java_lang_math_sqrt) {
    __ sqrtsd(xmm0, Address(rsp, wordSize));
  } else {
    __ fld_d(Address(rsp, wordSize));
    switch (kind) {
      case Interpreter::java_lang_math_sin :
          __ trigfunc('s');
          break;
      case Interpreter::java_lang_math_cos :
          __ trigfunc('c');
          break;
      case Interpreter::java_lang_math_tan :
          __ trigfunc('t');
          break;
      case Interpreter::java_lang_math_abs:
          __ fabs();
          break;
      case Interpreter::java_lang_math_log:
          __ flog();
          break;
      case Interpreter::java_lang_math_log10:
          __ flog10();
          break;
      case Interpreter::java_lang_math_pow:
          __ fld_d(Address(rsp, 3*wordSize)); // second argument (one
                                              // empty stack slot)
          __ pow_with_fallback(0);
          break;
      case Interpreter::java_lang_math_exp:
          __ exp_with_fallback(0);
           break;
      default                              :
          ShouldNotReachHere();
    }

    // return double result in xmm0 for interpreter and compilers.
    __ subptr(rsp, 2*wordSize);
    // Round to 64bit precision
    __ fstp_d(Address(rsp, 0));
    __ movdbl(xmm0, Address(rsp, 0));
    __ addptr(rsp, 2*wordSize);
  }


  __ pop(rax);
  __ mov(rsp, r13);
  __ jmp(rax);

  return entry_point;
}
开发者ID:4T-Shirt,项目名称:OpenJDK-Research,代码行数:98,代码来源:interpreter_x86_64.cpp


示例9: glReadPixels


//.........这里部分代码省略.........
   int x2 = x1, y2 = y1;

   int x,y,x0=W/2,y0=H/2;
   int min, max;
   float z = 1;
   while ( z == 1 ) {
      // top edge of rectangle
      if ( y1 >= 0 ) {
         y = y1;
         min = x1 < 0 ? 0 : x1;
         max = x2 >= W ? W-1 : x2;
         for ( x = min; x <= max; ++x )
            if ( zbuffer[ y*W + x ] < z ) {
               z = zbuffer[ y*W + x ];
               x0 = x;
               y0 = y;
            }
      }
      // bottom edge of rectangle
      if ( y2 < H ) {
         y = y2;
         min = x1 < 0 ? 0 : x1;
         max = x2 >= W ? W-1 : x2;
         for ( x = min; x <= max; ++x )
            if ( zbuffer[ y*W + x ] < z ) {
               z = zbuffer[ y*W + x ];
               x0 = x;
               y0 = y;
            }
      }
      // left edge of rectangle
      if ( x1 >= 0 ) {
         x = x1;
         min = y1 < 0 ? 0 : y1;
         max = y2 >= H ? H-1 : y2;
         for ( y = min; y <= max; ++y )
            if ( zbuffer[ y*W + x ] < z ) {
               z = zbuffer[ y*W + x ];
               x0 = x;
               y0 = y;
            }
      }
      // right edge of rectangle
      if ( x2 < W ) {
         x = x2;
         min = y1 < 0 ? 0 : y1;
         max = y2 >= H ? H-1 : y2;
         for ( y = min; y <= max; ++y )
            if ( zbuffer[ y*W + x ] < z ) {
               z = zbuffer[ y*W + x ];
               x0 = x;
               y0 = y;
            }
      }

      // grow the rectangle
      --x1;  --y1;
      ++x2;  ++y2;

      // is there nothing left to search ?
      if ( y1 < 0 && y2 >= H && x1 < 0 && x2 >= W )
         break;
   }

   if ( z < 1 ) {
      // compute point in clipping space
#ifdef OPENGL_CENTRE_BASED
      Point3 pc( 2*x0/(float)(W-1)-1, 2*y0/(float)(H-1)-1, 2*z-1 );
#else
      // The +0.5f here is to convert from centre-based coordinates
      // to edge-based coordinates.
      Point3 pc( 2*(x0+0.5f)/(float)W-1, 2*(y0+0.5f)/(float)H-1, 2*z-1 );
#endif

      // compute inverse view transform
      Matrix M;
      M.setToLookAt( _position, _target, _up, true );

      // compute inverse perspective transform
      Matrix M2;
      M2.setToFrustum(
         - 0.5 * _viewport_width,  0.5 * _viewport_width,    // left, right
         - 0.5 * _viewport_height, 0.5 * _viewport_height,   // bottom, top
         _near_plane, _far_plane,
         true
      );

      // compute inverse of light transform
      M = M * M2;

      // compute point in world space
      Point3 t0 = M * pc;
      Point3 t( t0.x()/t0.w(), t0.y()/t0.w(), t0.z()/t0.w() );

      lookAt( t );
   }

   delete [] zbuffer;
   zbuffer = 0;
}
开发者ID:fibo,项目名称:vvvv-SphereEversion,代码行数:101,代码来源:Camera.cpp


示例10: sp

inline bool frame::equal(frame other) const {
  return sp() == other.sp()
      && fp() == other.fp()
      && pc() == other.pc();
}
开发者ID:MuniyappanV,项目名称:jdk-source-code,代码行数:5,代码来源:frame_amd64.inline.hpp


示例11: pc

boost::shared_ptr<PointCloud> CloudList::addCloud(const char* filename) {
    boost::shared_ptr<PointCloud> pc(new PointCloud());
    pc->load_ptx(filename);
    return addCloud(pc);
}
开发者ID:circlingthesun,项目名称:Masters,代码行数:5,代码来源:cloudlist.cpp


示例12: TEST_F

TEST_F(LoadPlanningModelsPr2, PoseConstraintSamplerManager)
{
  robot_state::RobotState ks(kmodel);
  ks.setToDefaultValues();
  ks.update();
  robot_state::RobotState ks_const(kmodel);
  ks_const.setToDefaultValues();
  ks_const.update();

  kinematic_constraints::PositionConstraint pc(kmodel);

  moveit_msgs::PositionConstraint pcm;
  pcm.link_name = "l_wrist_roll_link";
  pcm.target_point_offset.x = 0;
  pcm.target_point_offset.y = 0;
  pcm.target_point_offset.z = 0;
  pcm.constraint_region.primitives.resize(1);
  pcm.constraint_region.primitives[0].type = shape_msgs::SolidPrimitive::SPHERE;
  pcm.constraint_region.primitives[0].dimensions.resize(1);
  pcm.constraint_region.primitives[0].dimensions[0] = 0.001;

  pcm.header.frame_id = kmodel->getModelFrame();

  pcm.constraint_region.primitive_poses.resize(1);
  pcm.constraint_region.primitive_poses[0].position.x = 0.55;
  pcm.constraint_region.primitive_poses[0].position.y = 0.2;
  pcm.constraint_region.primitive_poses[0].position.z = 1.25;
  pcm.constraint_region.primitive_poses[0].orientation.x = 0.0;
  pcm.constraint_region.primitive_poses[0].orientation.y = 0.0;
  pcm.constraint_region.primitive_poses[0].orientation.z = 0.0;
  pcm.constraint_region.primitive_poses[0].orientation.w = 1.0;
  pcm.weight = 1.0;

  moveit_msgs::OrientationConstraint ocm;

  ocm.link_name = "l_wrist_roll_link";
  ocm.header.frame_id = kmodel->getModelFrame();
  ocm.orientation.x = 0.0;
  ocm.orientation.y = 0.0;
  ocm.orientation.z = 0.0;
  ocm.orientation.w = 1.0;
  ocm.absolute_x_axis_tolerance = 0.2;
  ocm.absolute_y_axis_tolerance = 0.1;
  ocm.absolute_z_axis_tolerance = 0.4;
  ocm.weight = 1.0;

  // test the automatic construction of constraint sampler
  moveit_msgs::Constraints c;
  c.position_constraints.push_back(pcm);
  c.orientation_constraints.push_back(ocm);

  constraint_samplers::ConstraintSamplerPtr s = constraint_samplers::ConstraintSamplerManager::selectDefaultSampler(ps, "left_arm", c);
  EXPECT_TRUE(s.get() != NULL);
  constraint_samplers::IKConstraintSampler* iks = dynamic_cast<constraint_samplers::IKConstraintSampler*>(s.get());
  ASSERT_TRUE(iks);
  ASSERT_TRUE(iks->getPositionConstraint());
  ASSERT_TRUE(iks->getOrientationConstraint());

  static const int NT = 100;
  int succ = 0;
  for (int t = 0 ; t < NT ; ++t)
  {
    EXPECT_TRUE(s->sample(ks, ks_const, 100));
    EXPECT_TRUE(iks->getPositionConstraint()->decide(ks).satisfied);
    EXPECT_TRUE(iks->getOrientationConstraint()->decide(ks).satisfied);
    if (s->sample(ks, ks_const, 1))
      succ++;
  }
  ROS_INFO("Success rate for IK Constraint Sampler with position & orientation constraints for one arm: %lf", (double)succ / (double)NT);

  //add additional ocm with smaller volume
  ocm.absolute_x_axis_tolerance = 0.1;

  c.orientation_constraints.push_back(ocm);

  s = constraint_samplers::ConstraintSamplerManager::selectDefaultSampler(ps, "left_arm", c);
  EXPECT_TRUE(s.get() != NULL);

  iks = dynamic_cast<constraint_samplers::IKConstraintSampler*>(s.get());
  ASSERT_TRUE(iks);
  ASSERT_TRUE(iks->getOrientationConstraint());
  EXPECT_NEAR(iks->getOrientationConstraint()->getXAxisTolerance(),.1, .0001);
}
开发者ID:luandoan,项目名称:mbzirc.old,代码行数:83,代码来源:test_constraint_samplers.cpp


示例13: main


//.........这里部分代码省略.........

		boost::program_options::store(parse_config_file(cfgfile, cfgfile_options, true), vm);
		cfgfile.close();

		boost::program_options::notify(vm); // throws on error, so do after help in case
		// there are any problems
	} catch (boost::program_options::error& e) {
		std::cerr << "ERROR: " << e.what() << std::endl << std::endl;
		graceful_exit(idir, ERROR_COMMAND_LINE);
	}

	try {
		if (vm.count("log.file"))
			sLogFile = (const std::string&) vm["log.file"].as<std::string>();

		if (vm.count("log.filter"))
			sLogFilter = (const std::string&) vm["log.filter"].as<std::string>();

		if (vm.count("log.rotationsize"))
			iLogRotationSize = (int) vm["log.rotationsize"].as<int>();

		if (vm.count("log.format"))
			sLogFormat = (const std::string&) vm["log.format"].as<std::string>();

		if (vm.count("debian.location"))
			sDebianLocation = (const std::string&) vm["debian.location"].as<std::string>();

		if (vm.count("debian.type"))
			sDebianType = (const std::string&) vm["debian.type"].as<std::string>();

		if (vm.count("ros.version"))
			sRosVersion = (const std::string&) vm["ros.version"].as<std::string>();

		if (sPackageName.empty()) {
			std::cout << "Execution of this utility requires a package name" << std::endl;
			graceful_exit(idir, ERROR_COMMAND_LINE);
		}

		if (sArchitecture.empty()) {
			sPackageControlFile = sWorkingDir + "/pkgcontrol/"
					              + sPackageName + ".pkgctl";
		} else {
			sPackageControlFile = sWorkingDir + "/pkgcontrol/" + sPackageName +
					              "." + sArchitecture + ".pkgctl";
		}
    if (vm.count("database.host"))
      sDBHost = (const std::string&) vm["database.host"].as<std::string>();

    if (vm.count("database.database"))
      sDBDatabase = (const std::string&) vm["database.database"].as<std::string>();

    if (vm.count("database.port"))
      uiDBPort = (unsigned int) vm["database.port"].as<int>();

    if (vm.count("database.user"))
      sDBUser = (const std::string&) vm["database.user"].as<std::string>();

    if (vm.count("database.password"))
      sDBPassword = (const std::string&) vm["database.password"].as<std::string>();

	} catch (std::exception& e) {
		std::cerr << "Unhandled Exception reached after applying all options: "
				<< e.what() << ", application will now exit" << std::endl;
		graceful_exit(idir, ERROR_UNHANDLED_EXCEPTION);
	}

	/* Ready to run the utility
	 *
	 */
	ur::PackageControl pc(sPackageControlFile);
	pc.readControlFile();
	pc.setStageBase(sStageDir);
	ur::PackageXML px;
	px.readFile(pc.getPackageXML());

	if(bTest) {
		graceful_exit(idir, EXEC_SUCCESS);
	}

	ur::DebianPackage pkg(pc, px,
			              sArchitecture,
					      sSection,
					      sDebianType,
					      sDebianLocation,
					      sDBHost,
					      sDBDatabase,
					      sDBUser,
					      sDBPassword,
					      uiDBPort);

	pkg.createStageDirectory();
	pkg.stageManifest();
	pkg.writeDebianControleFile();
	pkg.generateChecksums();
	pkg.generateDebianPackage();
	pkg.moveDebianPackage();
	pkg.deleteStaging();

	return (EXEC_SUCCESS);
}
开发者ID:kchristofferson,项目名称:urpackager,代码行数:101,代码来源:urpackager.cpp


示例14: sizeof

void MetaspaceShared::generate_vtable_methods(void** vtbl_list,
                                                   void** vtable,
                                                   char** md_top,
                                                   char* md_end,
                                                   char** mc_top,
                                                   char* mc_end) {

  intptr_t vtable_bytes = (num_virtuals * vtbl_list_size) * sizeof(void*);
  *(intptr_t *)(*md_top) = vtable_bytes;
  *md_top += sizeof(intptr_t);
  void** dummy_vtable = (void**)*md_top;
  *vtable = dummy_vtable;
  *md_top += vtable_bytes;

  // Get ready to generate dummy methods.

  CodeBuffer cb((unsigned char*)*mc_top, mc_end - *mc_top);
  MacroAssembler* masm = new MacroAssembler(&cb);

  Label common_code;
  for (int i = 0; i < vtbl_list_size; ++i) {
    for (int j = 0; j < num_virtuals; ++j) {
      dummy_vtable[num_virtuals * i + j] = (void*)masm->pc();

      // Load rax, with a value indicating vtable/offset pair.
      // -- bits[ 7..0]  (8 bits) which virtual method in table?
      // -- bits[12..8]  (5 bits) which virtual method table?
      // -- must fit in 13-bit instruction immediate field.
      __ movl(rax, (i << 8) + j);
      __ jmp(common_code);
    }
  }

  __ bind(common_code);

#ifdef WIN32
  // Expecting to be called with "thiscall" conventions -- the arguments
  // are on the stack, except that the "this" pointer is in rcx.
#else
  // Expecting to be called with Unix conventions -- the arguments
  // are on the stack, including the "this" pointer.
#endif

  // In addition, rax was set (above) to the offset of the method in the
  // table.

#ifdef WIN32
  __ push(rcx);                         // save "this"
#endif
  __ mov(rcx, rax);
  __ shrptr(rcx, 8);                    // isolate vtable identifier.
  __ shlptr(rcx, LogBytesPerWord);
  Address index(noreg, rcx,  Address::times_1);
  ExternalAddress vtbl((address)vtbl_list);
  __ movptr(rdx, ArrayAddress(vtbl, index)); // get correct vtable address.
#ifdef WIN32
  __ pop(rcx);                          // restore "this"
#else
  __ movptr(rcx, Address(rsp, BytesPerWord));   // fetch "this"
#endif
  __ movptr(Address(rcx, 0), rdx);      // update vtable pointer.

  __ andptr(rax, 0x00ff);                       // isolate vtable method index
  __ shlptr(rax, LogBytesPerWord);
  __ addptr(rax, rdx);                  // address of real method pointer.
  __ jmp(Address(rax, 0));              // get real method pointer.

  __ flush();

  *mc_top = (char*)__ pc();
}
开发者ID:4T-Shirt,项目名称:OpenJDK-Research,代码行数:71,代码来源:metaspaceShared_x86_32.cpp


示例15: pc

bool InterruptedContext::in_system_trap() {
  if (scp == &dummy_scp)
    return false;
  // system call, sysenter instruction
  return pc()[0] == '\x0f'  &&  pc()[1] == '\x34';
}
开发者ID:russellallen,项目名称:self,代码行数:6,代码来源:interruptedCtx_i386.cpp


示例16: putn

inline void putn(int n){
	if(!n) pc('0');
	int pi = 0;
	while(n) pb[pi++] = (n%10) + '0', n /= 10;
	while(pi) pc(pb[--pi]);
}
开发者ID:arjun045,项目名称:codechef_programs,代码行数:6,代码来源:huge.c


示例17: main

int
main(int argc, char *argv[]) {
    nata_InitializeLogger(emit_Unknown, "", true, false, 0);

    dbgMsg("Enter.\n");

    setupSignals();
    ProcessJanitor::initialize();

    myArgs opts(argv[0]);
    if (opts.parse(argc - 1, argv + 1) != true) {
        return 1;
    }

    char * const *cppOpts = opts.getCppOptions();
    char * const *ldOpts = opts.getLinkerOptions();
    char * const *cp;
    const char * const *newArgv = NULL;
    int newArgc = 0;

    opts.getUnparsedOptions(newArgc, newArgv);

    if (cppOpts != NULL) {
        cp = cppOpts;
        fprintf(stderr, "CPPFLAGS = ");
        while (*cp != NULL) {
            fprintf(stderr, "%s ", *cp);
            cp++;
        }
        fprintf(stderr, "\n");
    }

    if (ldOpts != NULL) {
        cp = ldOpts;
        fprintf(stderr, "LDFLAGS = ");
        while (*cp != NULL) {
            fprintf(stderr, "%s ", *cp);
            cp++;
        }
        fprintf(stderr, "\n");
    }

    if (newArgc > 0) {
        int i;
        fprintf(stderr, "other = ");
        for (i = 0; i < newArgc; i++) {
            fprintf(stderr, "%s ", newArgv[i]);
        }
        fprintf(stderr, "\n");
    }

    return 0;

    const char * const cmd0[] = {
        "cat", "/etc/passwd", NULL
    };
    const char * const cmd1[] = {
        "sed", "s/^[a-zA-Z_][a-zA-Z0-9_\\-]*:/XXXXXXXX:/g", NULL
    };
    const char * const cmd2[] = {
        "cat", "-n", NULL
    };

    PipelinedCommands pc(-1, 1, 2);
    pc.addCommand(NULL, cmd0[0], (char * const *)cmd0);
    pc.addCommand(NULL, cmd1[0], (char * const *)cmd1);
    pc.addCommand(NULL, cmd2[0], (char * const *)cmd2);

    pc.start();

    return 0;
}
开发者ID:GPtpvWKrrZWERTEg,项目名称:a-library,代码行数:72,代码来源:ptest1.cpp


示例18: full_script

bool game_launcher::init_lua_script()
{
	bool error = false;

	std::cerr << "Checking lua scripts... ";

	if (cmdline_opts_.script_unsafe_mode) {
		plugins_manager::get()->get_kernel_base()->load_package(); //load the "package" package, so that scripts can get what packages they want
	}

	// get the application lua kernel, load and execute script file, if script file is present
	if (cmdline_opts_.script_file)
	{
		filesystem::scoped_istream sf = filesystem::istream_file(*cmdline_opts_.script_file);

		if (!sf->fail()) {
			/* Cancel all "jumps" to editor / campaign / multiplayer */
			jump_to_multiplayer_ = false;
			jump_to_editor_ = false;
			jump_to_campaign_.jump_ = false;

			std::string full_script((std::istreambuf_iterator<char>(*sf)), std::istreambuf_iterator<char>());

			std::cerr << "\nRunning lua script: " << *cmdline_opts_.script_file << std::endl;

			plugins_manager::get()->get_kernel_base()->run(full_script.c_str());
		} else {
			std::cerr << "Encountered failure when opening script '" << *cmdline_opts_.script_file << "'\n";
			error = true;
		}
	}

	if (cmdline_opts_.plugin_file)
	{
		std::string filename = *cmdline_opts_.plugin_file;

		std::cerr << "Loading a plugin file'" << filename << "'...\n";

		filesystem::scoped_istream sf = filesystem::istream_file(filename);

		try {
			if (sf->fail()) {
				throw std::runtime_error("failed to open plugin file");
			}

			/* Cancel all "jumps" to editor / campaign / multiplayer */
			jump_to_multiplayer_ = false;
			jump_to_editor_ = false;
			jump_to_campaign_.jump_ = false;

			std::string full_plugin((std::istreambuf_iterator<char>(*sf)), std::istreambuf_iterator<char>());

			plugins_manager & pm = *plugins_manager::get();

			size_t i = pm.add_plugin(filename, full_plugin);

			for (size_t j = 0 ; j < pm.size(); ++j) {
				std::cerr << j << ": " << pm.get_name(j) << " -- " << pm.get_detailed_status(j) << std::endl;
			}

			std::cerr << "Starting a plugin...\n";
			pm.start_plugin(i);

			for (size_t j = 0 ; j < pm.size(); ++j) {
				std::cerr << j << ": " << pm.get_name(j) << " -- " << pm.get_detailed_status(j) << std::endl;
			}

			plugins_context pc("init");

			for (size_t repeat = 0; repeat < 5; ++repeat) {
				std::cerr << "Playing a slice...\n";
				pc.play_slice();

				for (size_t j = 0 ; j < pm.size(); ++j) {
					std::cerr << j << ": " << pm.get_name(j) << " -- " << pm.get_detailed_status(j) << std::endl;
				}
			}

			return true;
		} catch (std::exception & e) {
			gui2::show_error_message(video(), std::string("When loading a plugin, error:\n") + e.what());
			error = true;
		}
	}

	if (!error) {
		std::cerr << "ok\n";
	}

	return !error;
}
开发者ID:doofus-01,项目名称:wesnoth,代码行数:91,代码来源:game_launcher.cpp


示例19: dialit

static char
dialit(char *phonenum, char *acu)
{
	struct vaconfig *vp;
	struct termios cntrl;
	char c;
	int i;

	phonenum = sanitize(phonenum);
#ifdef DEBUG
	(void) printf("(dial phonenum=%s)\n", phonenum);
#endif
	if (*phonenum == '<' && phonenum[1] == 0)
		return ('Z');
	for (vp = vaconfig; vp->vc_name; vp++)
		if (strcmp(vp->vc_name, acu) == 0)
			break;
	if (vp->vc_name == 0) {
		(void) printf("Unable to locate dialer (%s)\n", acu);
		return ('K');
	}
	(void) ioctl(AC, TCGETS, &cntrl);
	(void) cfsetospeed(&cntrl, B0);
	(void) cfsetispeed(&cntrl, B0);
	cntrl.c_cflag &= ~(CSIZE|PARENB|PARODD);
	(void) cfsetospeed(&cntrl, B2400);
	cntrl.c_cflag |= CS8;
	cntrl.c_iflag &= IXOFF|IXANY;
	cntrl.c_lflag &= ~(ICANON|ISIG);
	cntrl.c_oflag = 0;
	cntrl.c_cc[VMIN] = cntrl.c_cc[VTIME] = 0;
	(void) ioctl(AC, TCSETSF, &cntrl);
	(void) ioctl(AC, TCFLSH, TCOFLUSH);
	pc(STX);
	pc(vp->vc_rack);
	pc(vp->vc_modem);
	while (*phonenum && *phonenum != '<')
		pc(*phonenum++);
	pc(SI);
	pc(ETX);
	(void) sleep(1);
	i = read(AC, &c, 1);
#ifdef DEBUG
	printf("read %d chars, char=%c, errno %d\n", i, c, errno);
#endif
	if (i != 1)
		c = 'M';
	if (c == 'B' || c == 'G') {
		char cc, oc = c;

		pc(ABORT);
		(void) read(AC, &cc, 1);
#ifdef DEBUG
		(void) printf("abort response=%c\n", cc);
#endif
		c = oc;
		v831_disconnect();
	}
	(void) close(AC);
#ifdef DEBUG
	(void) printf("dialit: returns %c\n", c);
#endif
	return (c);
}
开发者ID:AlfredArouna,项目名称:illumos-gate,代码行数:64,代码来源:v831.c


示例20: main

int main(int argc, char* argv[])
{
	char tmp[1000];
	int fd, nread,i;
	char buf[BUF_SIZE];
	struct linux_dirent *d;
	int bpos;
	char d_type;
	int argLen=0;
	char* args[1024];
	localtime();
	for(i=1;i<argc;i++)
		if(argv[i][0]=='-')
		{
			int k=1;
			while(argv[i][k])
			{
				if(argv[i][k]=='a')
					fa=1;
				else if(argv[i][k]=='l')
					fl=1;
				else if(argv[i][k]=='h')
					fh=1;
				k++;
			}
		}
		else
			args[argLen++]=argv[i];
	if(argLen==0)
		args[argLen++]=".";
	for(i=0;i<argLen;i++)
	{
		write(1,args[i],getLen(args[i]));
		write(1,": \n",3);
		fd = open(args[i], O_RDONLY | O_DIRECTORY);
		if (fd == -1)
			handle_error("open");

		for ( ; ; ) {
			nread = syscall(SYS_getdents, fd, buf, BUF_SIZE);
			if (nread == -1)
				handle_error("getdents");
			if (nread == 0)
				break;
			for (bpos = 0; bpos < nread;) {
				struct stat sb;
				d = (struct linux_dirent *) (buf + bpos);
				d_type = *(buf + bpos + d->d_reclen - 1);
				char jj[10000],slash[2];
				slash[0]='/';
				slash[1]='\0';
				jj[0]='\0';
				mycat(jj,args[i]); if(jj[getLen(jj)-1]!='/') mycat(jj,slash); mycat(jj,d->d_name);
				if(!fa && !fl)
				{
					if(d->d_name[0]!='.')
					{
						lstat(jj,&sb);
						color = d_type == DT_LNK ? 3 : d_type == DT_DIR ? 2 : sb.st_mode & S_IXUSR ? 1 : 0;
						pc(color);
						write(1,("%s",d->d_name),getLen(d->d_name));
						pc(0);
						write(1,"\n",1);
					}
				}
				else if(fa && !fl)
				{
					lstat(jj,&sb);
					color = d_type == DT_LNK ? 3 : d_type == DT_DIR ? 2 : sb.st_mode & S_IXUSR ? 1 : 0;
					pc(color);
					write(1,("%s",d->d_name),getLen(d->d_name));
					pc(0);
					write(1,"\n",1);
				}
				else if(fa || fl)
				{
					if(!fa && d->d_name[0]=='.')
					{
						bpos += d->d_reclen;
						continue;
					}
					lstat(jj,&sb);

					if(DT_LNK == d_type) write(1,"l",1);
					else if(DT_DIR == d_type) write(1,"d",1);
					else if(DT_BLK == d_type) write(1,"b",1);
					else if(DT_SOCK == d_type) write(1,"s",1);
					else if(DT_CHR == 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ pcRel函数代码示例发布时间:2022-05-30
下一篇:
C++ pbx_builtin_setvar_helper函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap