Remove dead code

Remove dead code

--- src/chrono_parallel/physics/Ch3DOFRigidContainer.cpp
+++ src/chrono_parallel/physics/Ch3DOFRigidContainer.cpp
@@ -215,6 +215,7 @@

     return num_fluid_fluid;
 }
+
 int Ch3DOFRigidContainer::GetNumNonZeros() {
     int nnz_fluid_fluid = 0;
     if (mu == 0) {
@@ -247,6 +248,7 @@
         M_inv.finalize(offset + i * 3 + 2);
     }
 }
+
 void Ch3DOFRigidContainer::ComputeMass(int offset) {
     CompressedMatrix<real>& M = data_manager->host_data.M;
     uint num_fluid_bodies = data_manager->num_fluid_bodies;
@@ -261,6 +263,7 @@
         M.finalize(offset + i * 3 + 2);
     }
 }
+
 void Ch3DOFRigidContainer::Setup(int start_constraint) {
     Ch3DOFContainer::Setup(start_constraint);

@@ -388,6 +391,7 @@
         }
     }
 }
+
 void Ch3DOFRigidContainer::Build_E() {
     DynamicVector<real>& E = data_manager->host_data.E;

@@ -439,17 +443,6 @@

             gam.x += cohesion;

-            if (mu == 0) {
-                gam.x = gam.x < 0 ? 0 : gam.x - cohesion;
-                gam.y = gam.z = 0;
-
-                gamma[start_contact + index] = gam.x;
-                gamma[start_contact + num_rigid_contacts + index * 2 + 0] = gam.y;
-                gamma[start_contact + num_rigid_contacts + index * 2 + 1] = gam.z;
-
-                continue;
-            }
-
             Cone_generalized_rigid(gam.x, gam.y, gam.z, mu);

             gamma[start_contact + index] = gam.x - cohesion;
@@ -458,6 +451,7 @@
         }
     }
 }
+
 void Ch3DOFRigidContainer::GenerateSparsity() {
     CompressedMatrix<real>& D_T = data_manager->host_data.D_T;
     LOG(INFO) << "Ch3DOFRigidContainer::GenerateSparsity";
@@ -539,6 +533,7 @@
     }
     return real3(contact_forces[body_id * 6 + 3], contact_forces[body_id * 6 + 4], contact_forces[body_id * 6 + 5]);
 }
+
 void Ch3DOFRigidContainer::PreSolve() {
 #ifdef CHRONO_PARALLEL_USE_CUDA
     if (mpm_thread.joinable()) {
@@ -553,6 +548,7 @@
     }
 #endif
 }
+
 void Ch3DOFRigidContainer::PostSolve() {}

 void Ch3DOFRigidContainer::GetFluidForce(custom_vector<real3>& forc) {


Unpin blocks form the tuple stream from the back.

We read from the front so this maximizes the chance the block is not
evicted.

Change-Id: I6d8c6c6c1ec7f9ce34633b1d8d9cdeef16c9045f
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4488
Tested-by: jenkins
Reviewed-by: Nong Li <99a5e5f8f5911755b88e0b536d46aafa102bed41@cloudera.com>

--- be/src/runtime/buffered-tuple-stream.cc
+++ be/src/runtime/buffered-tuple-stream.cc
@@ -291,11 +291,15 @@
 Status BufferedTupleStream::UnpinStream(bool all) {
   DCHECK(!closed_);
   SCOPED_TIMER(unpin_timer_);
-  for (list<BufferedBlockMgr::Block*>::iterator it = blocks_.begin();
-      it != blocks_.end(); ++it) {
-    if (!(*it)->is_pinned()) continue;
-    if (!all && (*it == write_block_ || (read_write_ && it == read_block_))) continue;
-    RETURN_IF_ERROR((*it)->Unpin());
+
+  // Unpin the stream from the back. We read from the front so we want those blocks
+  // evicted last.
+  BOOST_REVERSE_FOREACH(BufferedBlockMgr::Block* block, blocks_) {
+    if (!block->is_pinned()) continue;
+    if (!all && (block == write_block_ || (read_write_ && block == *read_block_))) {
+      continue;
+    }
+    RETURN_IF_ERROR(block->Unpin());
     --num_pinned_;
     DCHECK_EQ(num_pinned_, NumPinned(blocks_));
   }


Let e.g. arrow keys cancel ^R search, and let them be properly interpreted.
Fixes http://root.cern.ch/phpBB2/viewtopic.php?t=9757

git-svn-id: acec3fd5b7ea1eb9e79d6329d318e8118ee2e14f@32112 27541ba8-7e3a-0410-8455-c3a389f83636

--- core/editline/src/search.cxx
+++ core/editline/src/search.cxx
@@ -359,8 +359,6 @@
          default:                       /* Terminate and execute cmd */
             endcmd[0] = ch;
             el_push(el, endcmd);
-         /* FALLTHROUGH */
-         case 0033:                     /* ESC: Terminate */
             ret = CC_REFRESH;
             done++;
             break;


Modify settings in M113 tracked vehicle demo:

- allow wider selection of solver and integrator
- track and display timing information
- use either an interactive driver or a data-driven driver

--- src/demos/vehicle/tracked_models/demo_VEH_M113.cpp
+++ src/demos/vehicle/tracked_models/demo_VEH_M113.cpp
@@ -16,12 +16,17 @@
 //
 // =============================================================================

+#include <sstream>
+
 #include "chrono/utils/ChUtilsInputOutput.h"
 #include "chrono/core/ChRealtimeStep.h"
-#include "chrono/solver/ChSolverBB.h"
-#include "chrono/physics/ChSystemSMC.h"
+
+#include "chrono/solver/ChIterativeSolverLS.h"
+#include "chrono/solver/ChIterativeSolverVI.h"
+#include "chrono/solver/ChDirectSolverLS.h"

 #include "chrono_vehicle/ChVehicleModelData.h"
+#include "chrono_vehicle/driver/ChDataDriver.h"
 #include "chrono_vehicle/driver/ChIrrGuiDriver.h"
 #include "chrono_vehicle/terrain/RigidTerrain.h"
 #include "chrono_vehicle/output/ChVehicleOutputASCII.h"
@@ -61,11 +66,39 @@
 double terrainLength = 100.0;  // size in X direction
 double terrainWidth = 100.0;   // size in Y direction

+// Specification of vehicle inputs
+enum class DriverMode {
+    KEYBOARD,  // interactive (Irrlicht) driver
+    DATAFILE   // inputs from data file
+};
+std::string driver_file("M113/driver/Acceleration.txt");  // used for mode=DATAFILE
+DriverMode driver_mode = DriverMode::DATAFILE;
+
+// Contact formulation (NSC or SMC)
+ChContactMethod contact_method = ChContactMethod::SMC;
+
 // Simulation step size
-double step_size = 5e-4;
-
-// Use HHT + MKL
-bool use_mkl = false;
+double step_size_NSC = 1e-3;
+double step_size_SMC = 5e-4;
+
+// Solver and integrator types
+////ChSolver::Type slvr_type = ChSolver::Type::BARZILAIBORWEIN;
+////ChSolver::Type slvr_type = ChSolver::Type::PSOR;
+////ChSolver::Type slvr_type = ChSolver::Type::MINRES;
+////ChSolver::Type slvr_type = ChSolver::Type::GMRES;
+////ChSolver::Type slvr_type = ChSolver::Type::SPARSE_LU;
+////ChSolver::Type slvr_type = ChSolver::Type::SPARSE_QR;
+ChSolver::Type slvr_type = ChSolver::Type::PARDISO_MKL;
+////ChSolver::Type slvr_type = ChSolver::Type::MUMPS;
+
+////ChTimestepper::Type intgr_type = ChTimestepper::Type::EULER_IMPLICIT;
+ChTimestepper::Type intgr_type = ChTimestepper::Type::EULER_IMPLICIT_PROJECTED;
+////ChTimestepper::Type intgr_type = ChTimestepper::Type::EULER_IMPLICIT_LINEARIZED;
+////ChTimestepper::Type intgr_type = ChTimestepper::Type::HHT;
+
+// Verbose output level (solver and integrator)
+bool verbose_solver = false;
+bool verbose_integrator = false;

 // Time interval between two render frames
 double render_step_size = 1.0 / 120;  // FPS = 120
@@ -90,6 +123,130 @@
 void AddFallingObjects(ChSystem* system);

 // =============================================================================
+
+void SelectSolver(ChSystem& sys, ChSolver::Type& solver_type, ChTimestepper::Type& integrator_type) {
+    // For NSC systems, use implicit linearized Euler and an iterative VI solver
+    if (sys.GetContactMethod() == ChContactMethod::NSC) {
+        integrator_type = ChTimestepper::Type::EULER_IMPLICIT_LINEARIZED;
+        if (solver_type != ChSolver::Type::BARZILAIBORWEIN && solver_type != ChSolver::Type::APGD &&
+            solver_type != ChSolver::Type::PSOR && solver_type != ChSolver::Type::PSSOR) {
+            solver_type = ChSolver::Type::BARZILAIBORWEIN;
+        }
+    }
+
+    // If none of the direct sparse solver modules is enabled, default to SPARSE_QR
+    if (solver_type == ChSolver::Type::PARDISO_MKL) {
+#ifndef CHRONO_PARDISO_MKL
+        solver_type = ChSolver::Type::SPARSE_QR;
+#endif
+    } else if (solver_type == ChSolver::Type::PARDISO_PROJECT) {
+#ifndef CHRONO_PARDISOPROJECT
+        solver_type = ChSolver::Type::SPARSE_QR;
+#endif
+    } else if (solver_type == ChSolver::Type::MUMPS) {
+#ifndef CHRONO_MUMPS
+        solver_type = ChSolver::Type::SPARSE_QR;
+#endif
+    }
+
+    if (solver_type == ChSolver::Type::PARDISO_MKL) {
+#ifdef CHRONO_PARDISO_MKL
+        auto solver = chrono_types::make_shared<ChSolverPardisoMKL>();
+        solver->LockSparsityPattern(true);
+        sys.SetSolver(solver);
+#endif
+    } else if (solver_type == ChSolver::Type::PARDISO_PROJECT) {
+#ifdef CHRONO_PARDISOPROJECT
+        auto solver = chrono_types::make_shared<ChSolverPardisoProject>();
+        solver->LockSparsityPattern(true);
+        sys->SetSolver(solver);
+#endif
+    } else if (solver_type == ChSolver::Type::MUMPS) {
+#ifdef CHRONO_MUMPS
+        auto solver = chrono_types::make_shared<ChSolverMumps>();
+        solver->LockSparsityPattern(true);
+        solver->EnableNullPivotDetection(true);
+        solver->GetMumpsEngine().SetICNTL(14, 50);
+        sys.SetSolver(solver);
+#endif
+    } else {
+        sys.SetSolverType(solver_type);
+        switch (solver_type) {
+            case ChSolver::Type::SPARSE_LU:
+            case ChSolver::Type::SPARSE_QR: {
+                auto solver = std::static_pointer_cast<ChDirectSolverLS>(sys.GetSolver());
+                solver->LockSparsityPattern(false);
+                solver->UseSparsityPatternLearner(false);
+                break;
+            }
+            case ChSolver::Type::BARZILAIBORWEIN:
+            case ChSolver::Type::APGD:
+            case ChSolver::Type::PSOR: {
+                auto solver = std::static_pointer_cast<ChIterativeSolverVI>(sys.GetSolver());
+                solver->SetMaxIterations(100);
+                solver->SetOmega(0.8);
+                solver->SetSharpnessLambda(1.0);
+
+                ////sys.SetMaxPenetrationRecoverySpeed(1.5);
+                ////sys.SetMinBounceSpeed(2.0);
+                break;
+            }
+            case ChSolver::Type::BICGSTAB:
+            case ChSolver::Type::MINRES:
+            case ChSolver::Type::GMRES: {
+                auto solver = std::static_pointer_cast<ChIterativeSolverLS>(sys.GetSolver());
+                solver->SetMaxIterations(200);
+                solver->SetTolerance(1e-10);
+                solver->EnableDiagonalPreconditioner(true);
+                break;
+            }
+        }
+    }
+
+    sys.SetTimestepperType(integrator_type);
+    switch (integrator_type) {
+        case ChTimestepper::Type::HHT: {
+            auto integrator = std::static_pointer_cast<ChTimestepperHHT>(sys.GetTimestepper());
+            integrator->SetAlpha(-0.2);
+            integrator->SetMaxiters(50);
+            integrator->SetAbsTolerances(1e-4, 1e2);
+            integrator->SetMode(ChTimestepperHHT::ACCELERATION);
+            integrator->SetStepControl(false);
+            integrator->SetModifiedNewton(false);
+            integrator->SetScaling(false);
+            break;
+        }
+        case ChTimestepper::Type::EULER_IMPLICIT: {
+            auto integrator = std::static_pointer_cast<ChTimestepperEulerImplicit>(sys.GetTimestepper());
+            integrator->SetMaxiters(50);
+            integrator->SetAbsTolerances(1e-4, 1e2);
+            break;
+        }
+        case ChTimestepper::Type::EULER_IMPLICIT_LINEARIZED:
+        case ChTimestepper::Type::EULER_IMPLICIT_PROJECTED:
+            break;
+    }
+}
+
+void ReportTiming(ChSystem& sys) {
+    std::stringstream ss;
+    ss.precision(4);
+    ss << std::fixed << sys.GetChTime() << " | ";
+    ss << sys.GetTimerStep() << " " << sys.GetTimerAdvance() << " " << sys.GetTimerUpdate() << " | ";
+    ss << sys.GetTimerJacobian() << " " << sys.GetTimerLSsetup() << " " << sys.GetTimerLSsolve() << " | ";
+    ss << sys.GetTimerCollision() << " " << sys.GetTimerCollisionBroad() << " " << sys.GetTimerCollisionNarrow();
+
+    auto LS = std::dynamic_pointer_cast<ChDirectSolverLS>(sys.GetSolver());
+    if (LS) {
+        ss << " | ";
+        ss << LS->GetTimeSetup_Assembly() << " " << LS->GetTimeSetup_SolverCall() << " ";
+        ss << LS->GetTimeSolve_Assembly() << " " << LS->GetTimeSolve_SolverCall();
+        LS->ResetTimers();
+    }
+    std::cout << ss.str() << std::endl;
+}
+
+// =============================================================================
 int main(int argc, char* argv[]) {
     GetLog() << "Copyright (c) 2017 projectchrono.org\nChrono version: " << CHRONO_VERSION << "\n\n";

@@ -100,10 +257,9 @@
     bool fix_chassis = false;
     bool create_track = true;

-    ChContactMethod contact_method = ChContactMethod::SMC;
     collision::ChCollisionSystemType collsys_type = collision::ChCollisionSystemType::BULLET;
     CollisionType chassis_collision_type = CollisionType::NONE;
-    TrackShoeType shoe_type = TrackShoeType::SINGLE_PIN;
+    TrackShoeType shoe_type = TrackShoeType::DOUBLE_PIN;
     BrakeType brake_type = BrakeType::SIMPLE;
     DrivelineTypeTV driveline_type = DrivelineTypeTV::BDS;
     PowertrainModelType powertrain_type = PowertrainModelType::SHAFTS;
@@ -135,7 +291,7 @@
     // Set visualization type for vehicle components.
     VisualizationType track_vis =
         (shoe_type == TrackShoeType::SINGLE_PIN) ? VisualizationType::MESH : VisualizationType::PRIMITIVES;
-    m113.SetChassisVisualizationType(VisualizationType::MESH);
+    m113.SetChassisVisualizationType(VisualizationType::NONE);
     m113.SetSprocketVisualizationType(track_vis);
     m113.SetIdlerVisualizationType(track_vis);
     m113.SetRoadWheelAssemblyVisualizationType(track_vis);
@@ -305,18 +461,29 @@
     // Create the driver system
     // ------------------------

-    ChIrrGuiDriver driver(app);
-
-    // Set the time response for keyboard inputs.
-    double steering_time = 0.5;  // time to go from 0 to +1 (or from 0 to -1)
-    double throttle_time = 1.0;  // time to go from 0 to +1
-    double braking_time = 0.3;   // time to go from 0 to +1
-    driver.SetSteeringDelta(render_step_size / steering_time);
-    driver.SetThrottleDelta(render_step_size / throttle_time);
-    driver.SetBrakingDelta(render_step_size / braking_time);
-    driver.SetGains(2, 5, 5);
-
-    driver.Initialize();
+    std::shared_ptr<ChDriver> driver;
+    switch (driver_mode) {
+        case DriverMode::KEYBOARD: {
+            auto irr_driver = chrono_types::make_shared<ChIrrGuiDriver>(app);
+            double steering_time = 0.5;  // time to go from 0 to +1 (or from 0 to -1)
+            double throttle_time = 1.0;  // time to go from 0 to +1
+            double braking_time = 0.3;   // time to go from 0 to +1
+            irr_driver->SetSteeringDelta(render_step_size / steering_time);
+            irr_driver->SetThrottleDelta(render_step_size / throttle_time);
+            irr_driver->SetBrakingDelta(render_step_size / braking_time);
+            irr_driver->SetGains(2, 5, 5);
+            driver = irr_driver;
+            break;
+        }
+        case DriverMode::DATAFILE: {
+            auto data_driver =
+                chrono_types::make_shared<ChDataDriver>(m113.GetVehicle(), vehicle::GetDataFile(driver_file));
+            driver = data_driver;
+            break;
+        }
+    }
+
+    driver->Initialize();

     // -----------------
     // Initialize output
@@ -354,51 +521,24 @@
     // Solver and integrator settings
     // ------------------------------

+    double step_size = 1e-3;
     switch (contact_method) {
         case ChContactMethod::NSC:
             std::cout << "Use NSC" << std::endl;
-            // Cannot use HHT + MKL with NSC contact
-            use_mkl = false;
+            step_size = step_size_NSC;
             break;
         case ChContactMethod::SMC:
             std::cout << "Use SMC" << std::endl;
+            step_size = step_size_SMC;
             break;
     }

-#ifndef CHRONO_PARDISO_MKL
-    use_mkl = false;
-#endif
-
-    if (use_mkl) {
-#ifdef CHRONO_PARDISO_MKL
-        std::cout << "Solver: PardisoMKL" << std::endl;
-        std::cout << "Integrator: HHT" << std::endl;
-
-        auto mkl_solver = chrono_types::make_shared<ChSolverPardisoMKL>();
-        mkl_solver->LockSparsityPattern(true);
-        m113.GetSystem()->SetSolver(mkl_solver);
-
-        m113.GetSystem()->SetTimestepperType(ChTimestepper::Type::HHT);
-        auto integrator = std::static_pointer_cast<ChTimestepperHHT>(m113.GetSystem()->GetTimestepper());
-        integrator->SetAlpha(-0.2);
-        integrator->SetMaxiters(50);
-        integrator->SetAbsTolerances(1e-4, 1e2);
-        integrator->SetMode(ChTimestepperHHT::ACCELERATION);
-        integrator->SetStepControl(false);
-        integrator->SetModifiedNewton(false);
-        integrator->SetScaling(true);
-        ////integrator->SetVerbose(true);
-#endif
-    } else {
-        auto solver = chrono_types::make_shared<ChSolverBB>();
-        solver->SetMaxIterations(120);
-        solver->SetOmega(0.8);
-        solver->SetSharpnessLambda(1.0);
-        m113.GetSystem()->SetSolver(solver);
-
-        m113.GetSystem()->SetMaxPenetrationRecoverySpeed(1.5);
-        m113.GetSystem()->SetMinBounceSpeed(2.0);
-    }
+    SelectSolver(*m113.GetSystem(), slvr_type, intgr_type);
+    m113.GetSystem()->GetSolver()->SetVerbose(verbose_solver);
+    m113.GetSystem()->GetTimestepper()->SetVerbose(verbose_integrator);
+
+    std::cout << "SOLVER TYPE:     " << (int)slvr_type << std::endl;
+    std::cout << "INTEGRATOR TYPE: " << (int)intgr_type << std::endl;

     // ---------------
     // Simulation loop
@@ -480,22 +620,24 @@
         }

         // Collect output data from modules
-        ChDriver::Inputs driver_inputs = driver.GetInputs();
+        ChDriver::Inputs driver_inputs = driver->GetInputs();
         m113.GetVehicle().GetTrackShoeStates(LEFT, shoe_states_left);
         m113.GetVehicle().GetTrackShoeStates(RIGHT, shoe_states_right);

         // Update modules (process inputs from other modules)
         double time = m113.GetVehicle().GetChTime();
-        driver.Synchronize(time);
+        driver->Synchronize(time);
         terrain.Synchronize(time);
         m113.Synchronize(time, driver_inputs, shoe_forces_left, shoe_forces_right);
         app.Synchronize("", driver_inputs);

         // Advance simulation for one timestep for all modules
-        driver.Advance(step_size);
+        driver->Advance(step_size);
         terrain.Advance(step_size);
         m113.Advance(step_size);
         app.Advance(step_size);
+
+        ReportTiming(*m113.GetSystem());

         // Report if the chassis experienced a collision
         if (m113.GetVehicle().IsPartInContact(TrackedCollisionFlag::CHASSIS)) {


An incremental change to signal_t::subscription_t that might be thrown out or might be weird somehow.

--- src/concurrency/signal.hpp
+++ src/concurrency/signal.hpp
@@ -41,15 +41,15 @@
     */
     class subscription_t : public home_thread_mixin_t {
     public:
-        explicit subscription_t(boost::function<void()> cb) : subs(cb) { }
-        subscription_t(boost::function<void()> cb, signal_t *s) : subs(cb) {
+        explicit subscription_t(boost::function<void()> cb) : cb_(cb), subs(this) { }
+        subscription_t(boost::function<void()> cb, signal_t *s) : cb_(cb), subs(this) {
             reset(s);
         }
         void reset(signal_t *s = NULL) {
             if (s) {
                 mutex_assertion_t::acq_t acq(&s->lock);
                 if (s->is_pulsed()) {
-                    (subs.subscriber)();
+                    (subs.subscriber->cb_)();
                 } else {
                     subs.reset(s->publisher_controller.get_publisher());
                 }
@@ -57,8 +57,10 @@
                 subs.reset(NULL);
             }
         }
+	friend class signal_t;
     private:
-        publisher_t<boost::function<void()> >::subscription_t subs;
+	boost::function<void()> cb_;
+        publisher_t<subscription_t *>::subscription_t subs;
         DISABLE_COPYING(subscription_t);
     };

@@ -95,12 +97,12 @@
     }

 private:
-    static void call(boost::function<void()>& fun) THROWS_NOTHING {
-        fun();
+    static void call(subscription_t *subscription) THROWS_NOTHING {
+        (subscription->cb_)();
     }

     bool pulsed;
-    publisher_controller_t<boost::function<void()> > publisher_controller;
+    publisher_controller_t<subscription_t *> publisher_controller;
     mutex_assertion_t lock;
     DISABLE_COPYING(signal_t);
 };


Method name change on QMediaMetadata

Method name change on QMediaMetadata

--- examples/player/player.cpp
+++ examples/player/player.cpp
@@ -144,5 +144,5 @@

 void Player::metaDataChanged()
 {
-    setWindowTitle(metaData->valueFor(QLatin1String("Title")).toString());
+    setWindowTitle(metaData->metadata(QLatin1String("Title")).toString());
 }