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


C++ Array_::empty方法代码示例

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


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

示例1: main

int main() {

    SimTK::Array_<std::string> failures;

    try {testSingleRigidTendonMuscle();}
    catch (const std::exception& e)
        {  cout << e.what() <<endl; failures.push_back("testSingleRigidTendonMuscle"); }

    // redo with the Millard2012EquilibriumMuscle 
    Object::renameType("Thelen2003Muscle", "Millard2012EquilibriumMuscle");

    try {testSingleMillardRigidTendonMuscle();}
    catch (const std::exception& e)
        {   cout << e.what() <<endl;
            failures.push_back("testSingleMillardRigidTendonMuscle"); }
    
    if (!failures.empty()) {
        cout << "Done, with failure(s): " << failures << endl;
        return 1;
    }

    cout << "Done" << endl;

    return 0;
}
开发者ID:ANKELA,项目名称:opensim-core,代码行数:25,代码来源:testCMCSingleRigidTendonMuscle.cpp

示例2: main

int main()
{
    SimTK::Array_<std::string> failures;

    try { testTorqueActuator(); }
    catch (const std::exception& e){
        cout << e.what() <<endl; failures.push_back("testTorqueActuator");
    }
    try { testClutchedPathSpring(); }
    catch (const std::exception& e){
        cout << e.what() <<endl; failures.push_back("testClutchedPathSpring");
    }
    try { testMcKibbenActuator(); }
    catch (const std::exception& e) {
        cout << e.what() << endl; failures.push_back("testMcKibbenActuator");
    }
    try { testBodyActuator(); }
    catch (const std::exception& e) {
        cout << e.what() << endl; failures.push_back("testBodyActuator");
    }
    try { testActuatorsCombination(); }
    catch (const std::exception& e) {
        cout << e.what() << endl; failures.push_back("testActuatorsCombination");
    }
    if (!failures.empty()) {
        cout << "Done, with failure(s): " << failures << endl;
        return 1;
    }

    cout << "Done, testActuators passed." << endl;
}
开发者ID:cpizzolato,项目名称:opensim-core,代码行数:31,代码来源:testActuators.cpp

示例3: main

int main()
{
    Array<string> muscleModelNames;
    muscleModelNames.append("Thelen2003Muscle_Deprecated"); 
    muscleModelNames.append("Thelen2003Muscle");    
    muscleModelNames.append("Millard2012EquilibriumMuscle");
    muscleModelNames.append("Millard2012AccelerationMuscle");

    // Tolerances for the differences between the current models
    // and the 'standard' solution, which was closest to using 
    // Thelen2003Muscle_Deprecated musle formulation.
    double actTols[4] = {0.005, 0.025, 0.04, 0.04};
    double forceTols[4] = {0.5, 4, 5, 6};

    SimTK::Array_<std::string> failures;
    
    for(int i=0; i< muscleModelNames.getSize(); ++i){
        try { // regression test for the Thelen deprecate muscle
              // otherwise verify that SO runs with the new models
            testArm26(muscleModelNames[i], actTols[i], forceTols[i]);
        }
        catch (const std::exception& e) {
            cout << e.what() <<endl; 
            failures.push_back("testArm26_"+muscleModelNames[i]);
        }
    }
  
    if (!failures.empty()) {
        cout << "Done, with failure(s): " << failures << endl;
        return 1;
    }

    cout << "Done" << endl;
    return 0;
}
开发者ID:fcanderson,项目名称:opensim-core,代码行数:35,代码来源:testStaticOptimization.cpp

示例4: main

int main()
{
    SimTK::Array_<std::string> failures;
    
    try { 
    Millard2012EquilibriumMuscle muscle("muscle",
                    MaxIsometricForce0,
                    OptimalFiberLength0,
                    TendonSlackLength0,
                    PennationAngle0);

    MuscleFirstOrderActivationDynamicModel actMdl = muscle.getFirstOrderActivationModel();
    actMdl.setActivationTimeConstant(Activation0);
    actMdl.setDeactivationTimeConstant(Deactivation0);
    muscle.setFirstOrderActivationModel(actMdl);

    double x0 = 0;
    double act0 = 0.2;

    Constant control(0.5);

    Sine motion(0.1, SimTK::Pi, 0);

    simulateMuscle(muscle, 
        x0, 
        act0, 
        &motion, 
        &control, 
        IntegrationAccuracy,
        CorrectnessTest,
        CorrectnessTestTolerance,
        true);
        
        
        cout << "Probes test passed" << endl; 
    }

    catch (const Exception& e) { 
        e.print(cerr);
        failures.push_back("testProbes");
    }


    printf("\n\n");
    cout <<"************************************************************"<<endl;
    cout <<"************************************************************"<<endl;

    if (!failures.empty()) {
        cout << "Done, with failure(s): " << failures << endl;
        return 1;
    }

    
    cout << "testProbes Done" << endl;
    return 0;
}
开发者ID:chrisdembia,项目名称:opensim-pythonwrap,代码行数:56,代码来源:testProbes.cpp

示例5: main

int main()
{
    SimTK::Array_<std::string> failures;

    try { testBody(); }
    catch (const std::exception& e){
        cout << e.what() <<endl; failures.push_back("testBody");
    }
        
    try { testPhysicalOffsetFrameOnBody(); }
    catch (const std::exception& e){
        cout << e.what() <<endl; 
        failures.push_back("testPhysicalOffsetFrameOnBody");
    }

    try { testPhysicalOffsetFrameOnBodySerialize(); }
    catch (const std::exception& e){
        cout << e.what() << endl; 
        failures.push_back("testPhysicalOffsetFrameOnBodySerialize");
    }
    
    try { testPhysicalOffsetFrameOnPhysicalOffsetFrame(); }
    catch (const std::exception& e){
        cout << e.what() << endl;
        failures.push_back("testPhysicalOffsetFrameOnPhysicalOffsetFrame");
    }

    try { testPhysicalOffsetFrameOnPhysicalOffsetFrameOrder(); }
    catch (const std::exception& e) {
        cout << e.what() << endl;
        failures.push_back("testPhysicalOffsetFrameOnPhysicalOffsetFrameOrder");
    }

    try { testFilterByFrameType(); }
    catch (const std::exception& e){
        cout << e.what() << endl;
        failures.push_back("testFilterByFrameType");
    }

    try { testVelocityAndAccelerationMethods(); }
    catch (const std::exception& e) {
        cout << e.what() << endl;
        failures.push_back("testVelocityAndAccelerationMethods");
    }

    if (!failures.empty()) {
        cout << "Done, with failure(s): " << failures << endl;
        return 1;
    }

    cout << "Done. All cases passed." << endl;

    return 0;
}
开发者ID:antoinefalisse,项目名称:opensim-core,代码行数:54,代码来源:testFrames.cpp

示例6: main

int main()
{
    SimTK::Array_<std::string> failures;

    // get all registered Components
    SimTK::Array_<Component*> availableComponents;

    // starting with type Frame
    ArrayPtrs<Frame> availableFrames;
    Object::getRegisteredObjectsOfGivenType(availableFrames);
    for (int i = 0; i < availableFrames.size(); ++i) {
        availableComponents.push_back(availableFrames[i]);
    }

    // then type Joint
    ArrayPtrs<Joint> availableJoints;
    Object::getRegisteredObjectsOfGivenType(availableJoints);
    for (int i = 0; i < availableJoints.size(); ++i) {
        availableComponents.push_back(availableJoints[i]);
    }

    // continue with Constraint, Actuator, Frame, ...
    //Example of an updated force that passes
    ArrayPtrs<PointToPointSpring> availablePointToPointSpring;
    Object::getRegisteredObjectsOfGivenType(availablePointToPointSpring);
    availableComponents.push_back(availablePointToPointSpring[0]);

    for (unsigned int i = 0; i < availableComponents.size(); i++) {
        try {
            testComponent(*availableComponents[i]);
        }
        catch (const std::exception& e) {
            cout << "*******************************************************\n";
            cout<< "FAILURE: " << availableComponents[i]->getConcreteClassName() << endl;
            cout<< e.what() << endl;
            failures.push_back(availableComponents[i]->getConcreteClassName());
        }
    }
    
    if (!failures.empty()) {
        cout << "*******************************************************\n";
        cout << "Done, with failure(s): " << failures << endl;
        cout << failures.size() << "/" << availableComponents.size() 
            << " components failed test." << endl;
        cout << 100 * (availableComponents.size() - failures.size()) / availableComponents.size()
            << "% components passed." << endl;
        cout << "*******************************************************\n" << endl;
        return 1;
    }
    cout << "\ntestComponents PASSED. " << availableComponents.size() 
        << " components were tested." << endl;
}
开发者ID:fcanderson,项目名称:opensim-core,代码行数:52,代码来源:testComponents.cpp

示例7: main

int main()
{
    SimTK::Array_<std::string> failures;

    try { testMarkersReference(); }
    catch (const std::exception& e) {
        cout << e.what() << endl;
        failures.push_back("testMarkersReference");
    }
    try { testOrientationsReference(); }
    catch (const std::exception& e) {
        cout << e.what() << endl;
        failures.push_back("testOrientationsReference");
    }
    try { testAccuracy(); }
    catch (const std::exception& e) {
        cout << e.what() << endl; failures.push_back("testAccuracy");
    }
    try { testUpdateMarkerWeights(); }
    catch (const std::exception& e) {
        cout << e.what() << endl;
        failures.push_back("testUpdateMarkerWeights");
    }
    try { testTrackWithUpdateMarkerWeights(); }
    catch (const std::exception& e) {
        cout << e.what() << endl;
        failures.push_back("testTrackWithUpdateMarkerWeights");
    }

    try { testNumberOfMarkersMismatch(); }
    catch (const std::exception& e) {
        cout << e.what() << endl;
        failures.push_back("testNumberOfMarkersMismatch");
    }

    try { testNumberOfOrientationsMismatch(); }
    catch (const std::exception& e) {
        cout << e.what() << endl;
        failures.push_back("testNumberOfOrientationsMismatch");
    }

    if (!failures.empty()) {
        cout << "Done, with failure(s): " << failures << endl;
        return 1;
    }

    cout << "Done. All cases passed." << endl;

    return 0;
}
开发者ID:antoinefalisse,项目名称:opensim-core,代码行数:50,代码来源:testInverseKinematicsSolver.cpp

示例8: main

int main() {
	Object::renameType("Thelen2003Muscle", "Thelen2003Muscle_Deprecated");

	SimTK::Array_<std::string> failures;

	// test manager/integration process
	try { testPendulum(); cout << "\nPendulum test PASSED " << endl; }	
    catch (const std::exception& e)
		{ cout << e.what() <<endl; failures.push_back("testPendulum"); }
	
	// test application of external loads
    try { testPendulumExternalLoad(); 
		cout << "\nPendulum with external load test PASSED " << endl; }
	catch (const std::exception& e)
		{ cout << e.what() <<endl; failures.push_back("testPendulumExternalLoad"); }

	// test application of external loads
    try { testPendulumExternalLoadWithPointInGround(); 
		cout << "\nPendulum with external load and point in ground PASSED " << endl; }
	catch (const std::exception& e)
		{ cout << e.what() <<endl; failures.push_back("testPendulumExternalLoadWithPointInGround"); }
	
	// now add computation of controls and generation of muscle forces
    try { testArm26(); 
		cout << "\narm26 test PASSED " << endl; }
	catch (const std::exception& e)
		{ cout << e.what() <<endl; failures.push_back("testArm26"); }
		
	// include applied ground reactions forces 
    try { testGait2354(); 
		cout << "\ngait2354 test PASSED " << endl; }
	catch (const std::exception& e)
		{ cout << e.what() <<endl; failures.push_back("testGait2354"); }		
		
	// finally include a controller
    try { testGait2354WithController(); 
		cout << "\ngait2354 with correction controller test PASSED " << endl; }
	catch (const std::exception& e)
		{ cout << e.what() <<endl; failures.push_back("testGait2354WithController"); }	

    if (!failures.empty()) {
        cout << "Done, with failure(s): " << failures << endl;
        return 1;
    }

	cout << "Done" << endl;
    return 0;
}
开发者ID:chrisdembia,项目名称:opensim-pythonwrap,代码行数:48,代码来源:testForward.cpp

示例9: main

int main()
{
	Array<string> muscleModelNames;
    muscleModelNames.append("Thelen2003Muscle_Deprecated");	
    muscleModelNames.append("Thelen2003Muscle");	
	muscleModelNames.append("Millard2012EquilibriumMuscle");
	muscleModelNames.append("Millard2012AccelerationMuscle");


    cout << "=========================================================" << endl;
    cout << "                       WARNING                           " << endl;
    cout << "Athough this file says it testsStaticOptimization, it is" << endl;
    cout << "not a valid test. It merely checks to see if the current" << endl;
    cout << "static results agree with past static results.          " << endl;
    cout << endl;
    cout << "                This is not a test                      " << endl;
    cout << endl;
    cout << "A valid test might be done by instead checking that " <<endl;
    cout << "1. IPOPT can correctly solve a quadradic problem " <<endl;
    cout << "2. That the muscle forces provided to static are in fact   "<<endl;
    cout << "   linear with activation, as is assumed in a static " << endl;
    cout << "   optimization.                       M.Millard 2012" << endl;
    cout << "=========================================================" << endl;
	
	SimTK::Array_<std::string> failures;
	
	for(int i=0; i< muscleModelNames.getSize(); ++i){
		try { // regression test for the Thelen deprecate muscle
			  // otherwise verify that SO runs with the new models
            testArm26(muscleModelNames[i], i<1);
		}
		catch (const std::exception& e) {
			cout << e.what() <<endl; 
			failures.push_back("testArm26_"+muscleModelNames[i]);
		}
	}
  
    if (!failures.empty()) {
        cout << "Done, with failure(s): " << failures << endl;
        return 1;
    }

    cout << "Done" << endl;
    return 0;
}
开发者ID:chrisdembia,项目名称:opensim-pythonwrap,代码行数:45,代码来源:testStaticOptimization.cpp

示例10: main

int main() {

    SimTK::Array_<std::string> failures;

    try{
        testCMCEMGDrivenArm();
    } catch(const std::exception& e) {  
        cout << e.what() <<endl; failures.push_back("testCMCEMGDrivenArm"); 
    }

    if (!failures.empty()) {
        cout << "Done, with failure(s): " << failures << endl;
        return 1;
    }

    cout << "Done" << endl;

    return 0;
}
开发者ID:antoinefalisse,项目名称:opensim-core,代码行数:19,代码来源:testCMCEMGDrivenArm_Thelen.cpp

示例11: main

int main() {
    Object::renameType("Thelen2003Muscle", "Thelen2003Muscle_Deprecated");
    //Object::renameType("Thelen2003Muscle", "Millard2012AccelerationMuscle");
    //Object::renameType("Thelen2003Muscle", "Millard2012EquilibriumMuscle");
    SimTK::Array_<std::string> failures;

    try {testGait2354();}
    catch (const std::exception& e)
        {  cout << e.what() <<endl; failures.push_back("testGait2354"); }

    if (!failures.empty()) {
        cout << "Done, with failure(s): " << failures << endl;
        return 1;
    }

    cout << "Done" << endl;

    return 0;
}
开发者ID:antoinefalisse,项目名称:opensim-core,代码行数:19,代码来源:testCMCWithControlConstraintsGait2354.cpp

示例12: main

int main() {

    SimTK::Array_<std::string> failures;

    Object::renameType("Thelen2003Muscle", "Millard2012EquilibriumMuscle");

    try{
        testCMCEMGDrivenArm();
    } catch (const std::exception& e) {  
        cout << e.what() <<endl; failures.push_back("testCMCEMGDrivenArm_Millard"); 
    }

    if (!failures.empty()) {
        cout << "Done, with failure(s): " << failures << endl;
        return 1;
    }

    cout << "Done" << endl;

    return 0;
}
开发者ID:cpizzolato,项目名称:opensim-core,代码行数:21,代码来源:testCMCEMGDrivenArm_Millard.cpp

示例13: main

int main()
{
    SimTK::Array_<std::string> failures;

    try { testPendulumModelWithNestedJoints<Device>(); }
    catch (const std::exception& e) {
        cout << e.what() << endl;
        failures.push_back("testPendulumModelWithNestedJoints<Device>");
    }
    try { testPendulumModelWithNestedJoints<Model>(); }
    catch (const std::exception& e) {
        cout << e.what() << endl;
        failures.push_back("testPendulumModelWithNestedJoints<Model>");
    }

    if (!failures.empty()) {
        cout << "Done, with failure(s): " << failures << endl;
        return 1;
    }

    cout << "Done. All cases passed." << endl;

    return 0;
}
开发者ID:cpizzolato,项目名称:opensim-core,代码行数:24,代码来源:testNestedModelComponents.cpp

示例14: main

int main()
{
    SimTK::Array_<std::string> failures;

    // get all registered Components
    SimTK::Array_<Component*> availableComponents;

    // starting with type Frame
    ArrayPtrs<Frame> availableFrames;
    Object::getRegisteredObjectsOfGivenType(availableFrames);
    for (int i = 0; i < availableFrames.size(); ++i) {
        availableComponents.push_back(availableFrames[i]);
    }

    // next with type Point
    ArrayPtrs<Point> availablePoints;
    Object::getRegisteredObjectsOfGivenType(availablePoints);
    for (int i = 0; i < availablePoints.size(); ++i) {
        availableComponents.push_back(availablePoints[i]);
    }

    // then type Joint
    ArrayPtrs<Joint> availableJoints;
    Object::getRegisteredObjectsOfGivenType(availableJoints);
    for (int i = 0; i < availableJoints.size(); ++i) {
        availableComponents.push_back(availableJoints[i]);
    }

    // then type TwoFrameLinker<Constraint>
    ArrayPtrs<TwoFrameLinker<Constraint, PhysicalFrame> > availableLink2Constraints;
    Object::getRegisteredObjectsOfGivenType(availableLink2Constraints);
    for (int i = 0; i < availableLink2Constraints.size(); ++i) {
        availableComponents.push_back(availableLink2Constraints[i]);
    }

    // then type TwoFrameLinker<Force> which are all the BushingForces
    ArrayPtrs<TwoFrameLinker<Force, PhysicalFrame> > availableBushingForces;
    Object::getRegisteredObjectsOfGivenType(availableBushingForces);
    for (int i = 0; i < availableBushingForces.size(); ++i) {
        availableComponents.push_back(availableBushingForces[i]);
    }

    // Test PrescribedForce
    std::unique_ptr<PrescribedForce> f(new PrescribedForce());
    availableComponents.push_back(f.get());
    // continue with other Constraints, Forces, Actuators, ...
    //Examples of updated forces that pass
    ArrayPtrs<PointToPointSpring> availablePointToPointSpring;
    Object::getRegisteredObjectsOfGivenType(availablePointToPointSpring);
    availableComponents.push_back(availablePointToPointSpring[0]);

    /** //Uncomment when dependencies of CoordinateCouplerConstraints are 
    // specified as Connectors 
    ArrayPtrs<Constraint> availableConstraints;
    Object::getRegisteredObjectsOfGivenType(availableConstraints);
    for (int i = 0; i < availableConstraints.size(); ++i) {
        availableComponents.push_back(availableConstraints[i]);
    }
    */

    for (unsigned int i = 0; i < availableComponents.size(); i++) {
        try {
            testComponent(*availableComponents[i]);
        }
        catch (const std::exception& e) {
            cout << "*******************************************************\n";
            cout<< "FAILURE: " << availableComponents[i]->getConcreteClassName() << endl;
            cout<< e.what() << endl;
            failures.push_back(availableComponents[i]->getConcreteClassName());
        }
    }
    
    if (!failures.empty()) {
        cout << "*******************************************************\n";
        cout << "Done, with failure(s): " << failures << endl;
        cout << failures.size() << "/" << availableComponents.size() 
            << " components failed test." << endl;
        cout << 100 * (availableComponents.size() - failures.size()) / availableComponents.size()
            << "% components passed." << endl;
        cout << "*******************************************************\n" << endl;
        return 1;
    }
    cout << "\ntestComponents PASSED. " << availableComponents.size() 
        << " components were tested." << endl;
}
开发者ID:sebastianskejoe,项目名称:opensim-core,代码行数:85,代码来源:testComponents.cpp

示例15: main

int main()
{
    int itc = 0;
    SimTK::Array_<std::string> failures;

    try { ++itc;
        testInverseKinematicsSolverWithOrientations(); 
    }
    catch (const std::exception& e) {
        cout << e.what() << endl;
        failures.push_back("testInverseKinematicsSolverWithOrientations");
    }

    try {
        ++itc;
        testInverseKinematicsSolverWithEulerAnglesFromFile();
    }
    catch (const std::exception& e) {
        cout << e.what() << endl;
        failures.push_back("testInverseKinematicsSolverWithEulerAnglesFromFile");
    }

    try {
        ++itc;
        testMarkerWeightAssignments("subject01_Setup_InverseKinematics.xml");
    }
    catch (const std::exception& e) {
        cout << e.what() << endl;
        failures.push_back("testMarkerWeightAssignments");
    }

    Storage  standard("std_subject01_walk1_ik.mot");
    try {
        InverseKinematicsTool ik1("subject01_Setup_InverseKinematics.xml");
        ik1.run();
        Storage result1(ik1.getOutputMotionFileName());
        CHECK_STORAGE_AGAINST_STANDARD(result1, standard, 
            std::vector<double>(24, 0.2), __FILE__, __LINE__, 
            "testInverseKinematicsGait2354 failed");
        cout << "testInverseKinematicsGait2354 passed" << endl;
    }
    catch (const std::exception& e) {
        cout << e.what() << endl;
        failures.push_back("testInverseKinematicsGait2354");
    }

    try {
        InverseKinematicsTool ik2("subject01_Setup_InverseKinematics_NoModel.xml");
        Model mdl("subject01_simbody.osim");
        mdl.initSystem();
        ik2.setModel(mdl);
        ik2.run();
        Storage result2(ik2.getOutputMotionFileName());
        CHECK_STORAGE_AGAINST_STANDARD(result2, standard, 
            std::vector<double>(24, 0.2), __FILE__, __LINE__, 
            "testInverseKinematicsGait2354 GUI workflow failed");
        cout << "testInverseKinematicsGait2354 GUI workflow passed" << endl;
    }
    catch (const std::exception& e) {
        cout << e.what() << endl;
        failures.push_back("testInverseKinematicsGait2354_GUI_workflow");
    }

    try {
        InverseKinematicsTool ik3("constraintTest_setup_ik.xml");
        ik3.run();
        cout << "testInverseKinematicsConstraintTest passed" << endl;
    }
    catch (const std::exception& e) {
        cout << e.what() << endl;
        failures.push_back("testInverseKinematicsConstraintTest");
    }

    if (!failures.empty()) {
        cout << "Done, with " << failures.size() << " failure(s) out of ";
        cout << itc << " test cases." << endl;
        cout << "Failure(s): " << failures << endl;
        return 1;
    }

    cout << "Done. All cases passed." << endl;
    return 0;
}
开发者ID:opensim-org,项目名称:opensim-core,代码行数:83,代码来源:testIK.cpp


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