Expose Solid 0.5.1 state APIs
This commit is contained in:
@@ -124,6 +124,26 @@ struct SolidSummary {
|
||||
double dt_limits[3];
|
||||
};
|
||||
|
||||
struct SolidParticleState {
|
||||
std::vector<double> values;
|
||||
std::vector<int> failure_status;
|
||||
std::vector<int> reference_neighbor_count;
|
||||
std::vector<int> reference_degenerate;
|
||||
std::vector<int> correction_status;
|
||||
};
|
||||
|
||||
struct SolidDiagnostics {
|
||||
double max_strain_rate;
|
||||
double max_acceleration;
|
||||
double internal_force_residual;
|
||||
};
|
||||
|
||||
struct SolidReferenceQuality {
|
||||
int reference_neighbor_min;
|
||||
double correction_det_min;
|
||||
int correction_status;
|
||||
};
|
||||
|
||||
class Error : public std::runtime_error {
|
||||
public:
|
||||
explicit Error(const std::string &message) : std::runtime_error(message) {}
|
||||
@@ -319,6 +339,44 @@ inline SolidSummary solid_summary()
|
||||
return summary;
|
||||
}
|
||||
|
||||
inline SolidParticleState solid_particle_state()
|
||||
{
|
||||
int count = particle_count();
|
||||
SolidParticleState state;
|
||||
state.values.resize(SPHLITE_SOLID_PARTICLE_VALUE_COUNT * count);
|
||||
state.failure_status.resize(count);
|
||||
state.reference_neighbor_count.resize(count);
|
||||
state.reference_degenerate.resize(count);
|
||||
state.correction_status.resize(count);
|
||||
int actual = 0;
|
||||
check(sphlite_get_solid_particle_state(count, state.values.data(),
|
||||
static_cast<int>(state.values.size()), state.failure_status.data(),
|
||||
state.reference_neighbor_count.data(), state.reference_degenerate.data(),
|
||||
state.correction_status.data(), &actual));
|
||||
return state;
|
||||
}
|
||||
|
||||
inline SolidDiagnostics solid_diagnostics()
|
||||
{
|
||||
double values[SPHLITE_SOLID_DIAGNOSTIC_VALUE_COUNT] = {0.0, 0.0, 0.0};
|
||||
check(sphlite_get_solid_diagnostics(
|
||||
values, SPHLITE_SOLID_DIAGNOSTIC_VALUE_COUNT));
|
||||
SolidDiagnostics diagnostics = {values[0], values[1], values[2]};
|
||||
return diagnostics;
|
||||
}
|
||||
|
||||
inline SolidReferenceQuality solid_reference_quality()
|
||||
{
|
||||
int reference_neighbor_min = 0;
|
||||
int correction_status = 0;
|
||||
double values[SPHLITE_SOLID_REFERENCE_VALUE_COUNT] = {0.0};
|
||||
check(sphlite_get_solid_reference_quality(&reference_neighbor_min,
|
||||
&correction_status, values, SPHLITE_SOLID_REFERENCE_VALUE_COUNT));
|
||||
SolidReferenceQuality quality = {
|
||||
reference_neighbor_min, values[0], correction_status};
|
||||
return quality;
|
||||
}
|
||||
|
||||
inline void set_output_directory(const std::string &path)
|
||||
{
|
||||
check(sphlite_set_output_directory(path.c_str()));
|
||||
|
||||
Reference in New Issue
Block a user