1 // =============================================================================
2 // PROJECT CHRONO - http://projectchrono.org
3 //
4 // Copyright (c) 2014 projectchrono.org
5 // All rights reserved.
6 //
7 // Use of this source code is governed by a BSD-style license that can be found
8 // in the LICENSE file at the top level of the distribution and at
9 // http://projectchrono.org/license-chrono.txt.
10 //
11 // =============================================================================
12 // Authors: Radu Serban
13 // =============================================================================
14 //
15 // Base class for a vehicle output database.
16 //
17 // =============================================================================
18 
19 #ifndef CH_VEHICLE_OUTPUT_H
20 #define CH_VEHICLE_OUTPUT_H
21 
22 #include <vector>
23 #include <string>
24 
25 #include "chrono_vehicle/ChApiVehicle.h"
26 
27 #include "chrono/physics/ChBody.h"
28 #include "chrono/physics/ChBodyAuxRef.h"
29 #include "chrono/physics/ChMarker.h"
30 #include "chrono/physics/ChShaft.h"
31 #include "chrono/physics/ChLink.h"
32 #include "chrono/physics/ChShaftsCouple.h"
33 #include "chrono/physics/ChLinkTSDA.h"
34 #include "chrono/physics/ChLinkRotSpringCB.h"
35 #include "chrono/physics/ChLoadsBody.h"
36 
37 namespace chrono {
38 namespace vehicle {
39 
40 /// @addtogroup vehicle
41 /// @{
42 
43 /// Base class for a vehicle output database.
44 class CH_VEHICLE_API ChVehicleOutput {
45   public:
46     enum Type {
47         ASCII,  ///< ASCII text
48         JSON,   ///< JSON
49         HDF5    ///< HDF-5
50     };
51 
ChVehicleOutput()52     ChVehicleOutput() {}
~ChVehicleOutput()53     virtual ~ChVehicleOutput() {}
54 
55     virtual void WriteTime(int frame, double time) = 0;
56 
57     virtual void WriteSection(const std::string& name) = 0;
58 
59     virtual void WriteBodies(const std::vector<std::shared_ptr<ChBody>>& bodies) = 0;
60     virtual void WriteAuxRefBodies(const std::vector<std::shared_ptr<ChBodyAuxRef>>& bodies) = 0;
61     virtual void WriteMarkers(const std::vector<std::shared_ptr<ChMarker>>& markers) = 0;
62     virtual void WriteShafts(const std::vector<std::shared_ptr<ChShaft>>& shafts) = 0;
63     virtual void WriteJoints(const std::vector<std::shared_ptr<ChLink>>& joints) = 0;
64     virtual void WriteCouples(const std::vector<std::shared_ptr<ChShaftsCouple>>& couples) = 0;
65     virtual void WriteLinSprings(const std::vector<std::shared_ptr<ChLinkTSDA>>& springs) = 0;
66     virtual void WriteRotSprings(const std::vector<std::shared_ptr<ChLinkRotSpringCB>>& springs) = 0;
67     virtual void WriteBodyLoads(const std::vector<std::shared_ptr<ChLoadBodyBody>>& loads) = 0;
68 };
69 
70 /// @} vehicle
71 
72 }  // end namespace vehicle
73 }  // end namespace chrono
74 
75 #endif
76