<commit_before>// =============================================================================
// PROJECT CHRONO - http://projectchrono.org
//
// Copyright (c) 2014 projectchrono.org
// All right reserved.
//
// Use of this source code is governed by a BSD-style license that can be found
// in the LICENSE file at the top level of the distribution and at
// http://projectchrono.org/license-chrono.txt.
//
// =============================================================================
// Author: <NAME>
// =============================================================================
//
// Implementation of fsi system that includes all subclasses for proximity and
// force calculation, and time integration
// =============================================================================

#ifndef CH_SYSTEMFSI_H_
#define CH_SYSTEMFSI_H_

#include "chrono_fsi/ChFsiDataManager.cuh"
#include "chrono_fsi/ChFluidDynamics.cuh"
#include "chrono_fsi/ChFsiInterface.h"
#include "chrono_fsi/ChBce.cuh"

#include "chrono_parallel/physics/ChSystemParallel.h"
#include "chrono_vehicle/wheeled_vehicle/utils/ChWheeledVehicleAssembly.h"

#ifdef CHRONO_OPENGL
#include "chrono_opengl/ChOpenGLWindow.h"
#endif

namespace chrono {
namespace fsi {

class CH_FSI_API ChSystemFsi : public ChFsiGeneral {
 public:
  ChSystemFsi(ChSystemParallelDVI* other_physicalSystem, bool other_haveFluid);
  ~ChSystemFsi();

  void DoStepDynamics_FSI();
  void DoStepDynamics_ChronoRK2();
  void CopyDeviceDataToHalfStep();
  void SetVehicle(chrono::vehicle::ChWheeledVehicleAssembly* other_mVehicle);
  void FinalizeData();
  ChFsiDataManager* GetDataManager() { return fsiData; }
  SimParams* GetSimParams() { return paramsH; }
  //	void SetSimParams(SimParams* other_paramsH) {paramsH = other_paramsH;} // It is not enough to just set sim
  //params here. It should recursively go and set for all subclasses
  std::vector<std::shared_ptr<ChBody> >* GetFsiBodiesPtr() { return &fsiBodeisPtr; }
  void InitializeChronoGraphics(chrono::ChVector<> CameraLocation = chrono::ChVector<>(1, 0, 0),
                                chrono::ChVector<> CameraLookAt = chrono::ChVector<>(0, 0, 0));

  virtual void Finalize();

 private:
  int DoStepChronoSystem(Real dT, double mTime);

  ChFsiDataManager* fsiData;
  // map fsi to chrono bodies
  std::vector<std::shared_ptr<ChBody> > fsiBodeisPtr;
  ChFluidDynamics* fluidDynamics;
  ChFsiInterface* fsiInterface;
  ChBce* bceWorker;

  chrono::ChSystemParallelDVI* mphysicalSystem;
  chrono::vehicle::ChWheeledVehicleAssembly* mVehicle;

  SimParams* paramsH;
  NumberOfObjects* numObjectsH;

  double mTime;
  bool haveFluid;
  bool haveVehicle;

#ifdef CHRONO_OPENGL
  chrono::opengl::ChOpenGLWindow* gl_window;
#endif
};
}  // end namespace fsi
}  // end namespace chrono
#endif
<commit_msg>cleaned up the ChSystemFsi and added comments<commit_after>// =============================================================================
// PROJECT CHRONO - http://projectchrono.org
//
// Copyright (c) 2014 projectchrono.org
// All right reserved.
//
// Use of this source code is governed by a BSD-style license that can be found
// in the LICENSE file at the top level of the distribution and at
// http://projectchrono.org/license-chrono.txt.
//
// =============================================================================
// Author: <NAME>
// =============================================================================
//
// Implementation of fsi system that includes all subclasses for proximity and
// force calculation, and time integration
// =============================================================================

#ifndef CH_SYSTEMFSI_H_
#define CH_SYSTEMFSI_H_

#include "chrono_fsi/ChFsiDataManager.cuh"
#include "chrono_fsi/ChFluidDynamics.cuh"
#include "chrono_fsi/ChFsiInterface.h"
#include "chrono_fsi/ChBce.cuh"

#include "chrono_parallel/physics/ChSystemParallel.h"
#include "chrono_vehicle/wheeled_vehicle/utils/ChWheeledVehicleAssembly.h"

#ifdef CHRONO_OPENGL
#include "chrono_opengl/ChOpenGLWindow.h"
#endif

namespace chrono {
namespace fsi {

/// Physical system for fluid-solid interaction problem
///
/// This class is used to represent a fluid-solid interaction problem consist of
/// fluid dynamics and multibody system. Each of the two underlying physics are
/// independent objects owned and instantiated by this class. Additionally,
/// the fsi system owns other objects to handle the interface between the two
/// systems, boundary condition enforcing markers, and data.
class CH_FSI_API ChSystemFsi : public ChFsiGeneral {
 public:

	/// constructor for fsi system
	///
	/// This class constructor instantiates all the member objects. Wherever relevant, the
	/// instantiation is handled by sending a pointer to other objects or data.
	/// Therefore, the sub-classes have pointers to the same data
  ChSystemFsi(ChSystemParallelDVI* other_physicalSystem, bool other_haveFluid);

  /// destructor for the fsi system
  ~ChSystemFsi();

  /// function to integrate the fsi system in time.
  ///
  /// It uses a Runge-Kutta 2nd order algorithm to update both the fluid and multibody
  /// system dynamics. The midpoint data of MBS is needed for fluid dynamics update.
  void DoStepDynamics_FSI();

  /// function to integrate the multibody system dynamics based on Runge-Kutta 2nd
  /// order integration scheme
  void DoStepDynamics_ChronoRK2();

  /// function to initialize the midpoint device data of the fluid system by
  /// copying from the full step
  void CopyDeviceDataToHalfStep();

  /// instantiate the member vehicle pointer from an external objects.
  void SetVehicle(chrono::vehicle::ChWheeledVehicleAssembly* other_mVehicle);

  /// Function to fill out the dependent data based on the independent one. For instance
  /// it copies the position of the rigid bodies from the multibody dynamics system
  /// to arrays in fsi system since they are needed for internal use.
  void FinalizeData();

  /// function to return the pointer to the data manager
  ChFsiDataManager* GetDataManager() { return fsiData; }

  /// function to return the pointer to the data
  SimParams* GetSimParams() { return paramsH; }

  /// function to return the pointer to the fsi bodies. The pointer to all fsi bodies, i.e. the bodies
  /// with two representation in fluid and multibody systems, are stored in a vector.
  std::vector<std::shared_ptr<ChBody> >* GetFsiBodiesPtr() { return &fsiBodeisPtr; }

  /// Initialize the graphics interface of the chrono system
  void InitializeChronoGraphics(chrono::ChVector<> CameraLocation = chrono::ChVector<>(1, 0, 0),
                                chrono::ChVector<> CameraLookAt = chrono::ChVector<>(0, 0, 0));

  /// Finzalize data by calling FinalizeData function and finalize fluid and bce objects if the
  /// system have fluid.
  virtual void Finalize();

 private:
  /// Integrate the chrono system based on an explicit Euler scheme.
  int DoStepChronoSystem(Real dT, double mTime);

  ChFsiDataManager* fsiData;						///< pointer to data manager which holds all the data
  std::vector<std::shared_ptr<ChBody> > fsiBodeisPtr;	///< vector of a pointers to fsi bodies. fsi bodies
  	  	  	  	  	  	  	  	  	  	  	  	  	  	/// are those that interact with fluid
  ChFluidDynamics* fluidDynamics;					///< pointer to the fluid system
  ChFsiInterface* fsiInterface;						///< pointer to the fsi interface system
  ChBce* bceWorker;									///< pointer to the bce workers

  chrono::ChSystemParallelDVI* mphysicalSystem;		///< pointer to the multibody system
  chrono::vehicle::ChWheeledVehicleAssembly* mVehicle;	///< pointer to vehicle, if exist.

  SimParams* paramsH;								///< pointer to the simulation parameters
  NumberOfObjects* numObjectsH;						///< pointer to the number of objects, fluid, bce, and boundary markers

  double mTime;										///< current real time of the simulation
  bool haveFluid;									///< boolean to check if the system have fluid or not
  bool haveVehicle;									///< boolean to check if the system have vehicle

#ifdef CHRONO_OPENGL
  chrono::opengl::ChOpenGLWindow* gl_window;		///< opengl graphics window if opengl exist
#endif
};
}  // end namespace fsi
}  // end namespace chrono
#endif

{'fraction_non_alphanumeric': 0.16067524896769492, 'fraction_numerical': 0.002914743745445713, 'mean_word_length': 4.185768261964736, 'pattern_counts': {'":': 0, '<': 34, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1050007', 'n_tokens_mistral': 2487, 'n_tokens_neox': 2341, 'n_words': 774}