1 // =============================================================================
2 // PROJECT CHRONO - http://projectchrono.org
3 //
4 // Copyright (c) 2021 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 // Chrono custom multicore collision system for Chrono::Multicore.
16 //
17 // =============================================================================
18 
19 #ifndef CH_COLLISION_SYSTEM_CHRONO_MULTICORE_H
20 #define CH_COLLISION_SYSTEM_CHRONO_MULTICORE_H
21 
22 #include "chrono_multicore/ChApiMulticore.h"
23 #include "chrono_multicore/ChDataManager.h"
24 
25 #include "chrono/collision/ChCollisionSystemChrono.h"
26 
27 namespace chrono {
28 
29 // Forward declaration for friend class declaration
30 class ChSystemMulticore;
31 
32 namespace collision {
33 
34 /// @addtogroup multicore_collision
35 /// @{
36 
37 /// Chrono custom multicore collision system.
38 /// Contains both the broadphase and the narrow phase methods.
39 class CH_MULTICORE_API ChCollisionSystemChronoMulticore : public ChCollisionSystemChrono {
40   public:
41     ChCollisionSystemChronoMulticore(ChMulticoreDataManager* dc);
42     ~ChCollisionSystemChronoMulticore();
43 
44     /// Set the number of OpenMP threads for collision detection.
45     virtual void SetNumThreads(int nthreads) override;
46 
47     /// Synchronization operations, invoked before running the collision detection.
48     /// Different from the base class function, this overrides points to already allocated contactable state
49     /// information (in the Chrono::Multicore data manager).
50     virtual void PreProcess() override;
51 
52     /// Synchronization operations, invoked after running the collision detection.
53     virtual void PostProcess() override;
54 
55     /// Fill in the provided contact container with collision information after Run().
56     /// Different from the base class function, this override loads into a ChContactContainerMulticore.
57     virtual void ReportContacts(ChContactContainer* container) override;
58 
59     /// Fill in the provided proximity container with near point information after Run().
60     /// Not used.
ReportProximities(ChProximityContainer * mproximitycontainer)61     virtual void ReportProximities(ChProximityContainer* mproximitycontainer) override {}
62 
63   private:
64     ChMulticoreDataManager* data_manager;
65 
66     friend class chrono::ChSystemMulticore;
67 };
68 
69 /// @} multicore_colision
70 
71 }  // end namespace collision
72 }  // end namespace chrono
73 
74 #endif
75