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


C++ ChSharedPtr::Get_spe_funct方法代码示例

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


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

示例1: main


//.........这里部分代码省略.........
//				ChVector<>(
//						1 / 12.0 * anchor_mass * (1 * 1 + anchor_R * anchor_R),
//						1 / 12.0 * anchor_mass * (anchor_R * anchor_R + anchor_R * anchor_R),
//						1 / 12.0 * anchor_mass * (anchor_R * anchor_R + 1 * 1)));

		//BLOCK = ChSharedBodyPtr(new ChBody(new ChCollisionModelParallel));
		//InitObject(BLOCK, anchor_mass/2, Vector(0, 300, 0), Quaternion(1, 0, 0, 0), material, false, false, -20, -20);
		//AddCollisionGeometry(BLOCK, BOX, ChVector<>(1, 1, 1), Vector(0, 0, 0), Quaternion(1, 0, 0, 0));
		//FinalizeObject(BLOCK, (ChSystemParallel *) system_gpu);

		//actuator_anchor = ChSharedPtr<ChLinkLockLock>(new ChLinkLockLock());
		//actuator_anchor->Initialize(CONTAINER, BLOCK, ChCoordsys<>(ChVector<>(0, 0, 0), QUNIT));
		//system_gpu->AddLink(actuator_anchor);

		// apply motion
		//motionFunc1 = new ChFunction_Ramp(0, -anchor_vel);
		//actuator_anchor->SetMotion_Y(motionFunc1);
		//actuator_anchor->SetMotion_axis(ChVector<>(0, 1, 0));

		engine_anchor = ChSharedPtr<ChLinkEngine>(new ChLinkEngine);
		engine_anchor->Initialize(CONTAINER, ANCHOR, ChCoordsys<>(ANCHOR->GetPos(), chrono::Q_from_AngAxis(CH_C_PI / 2, VECT_X)));
		engine_anchor->Set_shaft_mode(ChLinkEngine::ENG_SHAFT_PRISM);     // also works as revolute support
		engine_anchor->Set_eng_mode(ChLinkEngine::ENG_MODE_SPEED);

		system_gpu->AddLink(engine_anchor);

		reference_engine = ChSharedPtr<ChLinkEngine>(new ChLinkEngine);
		reference_engine->Initialize(CONTAINER, REFERENCE, ChCoordsys<>(REFERENCE->GetPos(), chrono::Q_from_AngAxis(CH_C_PI / 2, VECT_X)));
		reference_engine->Set_shaft_mode(ChLinkEngine::ENG_SHAFT_PRISM);     // also works as revolute support
		reference_engine->Set_eng_mode(ChLinkEngine::ENG_MODE_SPEED);

		system_gpu->AddLink(reference_engine);

		if (ChFunction_Const* mfun = dynamic_cast<ChFunction_Const*>(engine_anchor->Get_spe_funct())) {
			mfun->Set_yconst(anchor_rot * 1 / 60.0 * 2 * CH_C_PI);     // rad/s  angular speed
		}

		if (ChFunction_Const* mfun = dynamic_cast<ChFunction_Const*>(reference_engine->Get_spe_funct())) {
			mfun->Set_yconst(anchor_rot * 1 / 60.0 * 2 * CH_C_PI);     // rad/s  angular speed
		}

		ReadAllObjectsWithGeometryChrono(system_gpu, "data/anchor/anchor.dat");
		ChSharedPtr<ChMaterialSurface> material_read;
		material_read = ChSharedPtr<ChMaterialSurface>(new ChMaterialSurface);
		material_read->SetFriction(particle_slide_friction);
		material_read->SetRollingFriction(particle_roll_friction);
		material_read->SetSpinningFriction(particle_roll_friction);
		material_read->SetCompliance(0);
		material_read->SetCohesion(particle_cohesion * timestep);

		for (int i = 0; i < system_gpu->Get_bodylist()->size(); i++) {
			system_gpu->Get_bodylist()->at(i)->SetMaterialSurface(material_read);
		}

	} else {
		layer_gen = new ParticleGenerator<ChSystemParallelDVI>((ChSystemParallelDVI *) system_gpu);
		layer_gen->SetDensity(particle_density);
		layer_gen->SetRadius(R3(particle_radius, particle_radius * .5, particle_radius));
		layer_gen->SetNormalDistribution(particle_radius, particle_std_dev, 1);
		layer_gen->material->SetFriction(particle_slide_friction);
		layer_gen->material->SetCohesion(particle_cohesion);
		layer_gen->material->SetRollingFriction(0);
		layer_gen->material->SetSpinningFriction(0);
		layer_gen->AddMixtureType(MIX_SPHERE);
	}
	//layer_gen->AddMixtureType(MIX_ELLIPSOID);
开发者ID:rserban,项目名称:chrono_models,代码行数:67,代码来源:anchor.cpp


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