LaminaStressStrainInput.fromJson constructor

LaminaStressStrainInput.fromJson(
  1. Map<String, dynamic> json
)

Implementation

factory LaminaStressStrainInput.fromJson(Map<String, dynamic> json) {
  return LaminaStressStrainInput(
    analysisType: AnalysisType.values.firstWhere(
      (e) =>
          e.toString() ==
          'AnalysisType.' + (json['analysis_type'] ?? 'elastic'),
      orElse: () => AnalysisType.elastic, // Default value if not found
    ),
    E1: (json['E1'] ?? 0).toDouble(),
    E2: (json['E2'] ?? 0).toDouble(),
    G12: (json['G12'] ?? 0).toDouble(),
    nu12: (json['nu12'] ?? 0).toDouble(),
    layupAngle: (json['layup_angle'] ?? 0).toDouble(),
    alpha11: (json['alpha11'] ?? 0).toDouble(),
    alpha22: (json['alpha22'] ?? 0).toDouble(),
    alpha12: (json['alpha12'] ?? 0).toDouble(),
    deltaT: (json['deltaT'] ?? 0).toDouble(),
    tensorType: TensorType.values.firstWhere(
      (e) => e.toString() == 'TensorType.' + (json['tensorType'] ?? 'stress'),
      orElse: () => TensorType.stress, // Default value if not found
    ),
    sigma11: (json['sigma11'] ?? 0).toDouble(),
    sigma22: (json['sigma22'] ?? 0).toDouble(),
    sigma12: (json['sigma12'] ?? 0).toDouble(),
    epsilon11: (json['epsilon11'] ?? 0).toDouble(),
    epsilon22: (json['epsilon22'] ?? 0).toDouble(),
    gamma12: (json['gamma12'] ?? 0).toDouble(),
  );
}