Skip to content

Commit

Permalink
Synchronize with TFEL-3.4.1 release and later
Browse files Browse the repository at this point in the history
  • Loading branch information
thelfer committed May 25, 2021
1 parent 884c283 commit 3261926
Show file tree
Hide file tree
Showing 27 changed files with 1,360 additions and 509 deletions.
55 changes: 55 additions & 0 deletions bindings/c/include/MGIS/Behaviour/MaterialDataManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,15 @@ MGIS_C_EXPORT mgis_status mgis_bv_create_material_data_manager_initializer(
MGIS_C_EXPORT
mgis_status mgis_bv_material_data_manager_initializer_bind_tangent_operator(
mgis_bv_MaterialDataManagerInitializer*, mgis_real* const, mgis_size_type);
/*!
* \brief bind the speed of sound to the given array
* \param[in,out] d: initializer
* \param[in] p: pointer to a memory area meant to store the speed of sound values
* \param[in] s: size of the memory area
*/
MGIS_C_EXPORT
mgis_status mgis_bv_material_data_manager_initializer_bind_speed_of_sound(
mgis_bv_MaterialDataManagerInitializer*, mgis_real* const, mgis_size_type);
/*!
* \brief set the state at the beginning of the time step
* \param[out] s: pointer to a pointer to the state initializer
Expand Down Expand Up @@ -102,6 +111,52 @@ MGIS_C_EXPORT mgis_status mgis_bv_create_material_data_manager_with_initializer(
const mgis_bv_Behaviour* const,
const mgis_size_type,
const mgis_bv_MaterialDataManagerInitializer* const);
/*!
* \param[in] d: material data manager
* \param[in] b: boolean value
*/
MGIS_C_EXPORT mgis_status mgis_bv_material_data_manager_set_thread_safe(
mgis_bv_MaterialDataManager*, const mgis_size_type);
/*!
* \param[in] d: material data manager
*/
MGIS_C_EXPORT mgis_status
mgis_bv_material_data_manager_allocate_array_of_tangent_operator_blocks(
mgis_bv_MaterialDataManager* const);
/*!
* \param[in] d: material data manager
* \param[in] p: pointer to a memory buffer
* \param[in] s: size of the a memory buffer
*/
MGIS_C_EXPORT mgis_status
mgis_bv_material_data_manager_use_external_array_of_tangent_operator_blocks(
mgis_bv_MaterialDataManager* const, mgis_real* const, const mgis_size_type);
/*!
* \param[in] d: material data manager
*/
MGIS_C_EXPORT mgis_status
mgis_bv_material_data_manager_release_array_of_tangent_operator_blocks(
mgis_bv_MaterialDataManager*const);
/*!
* \param[in] d: material data manager
*/
MGIS_C_EXPORT mgis_status
mgis_bv_material_data_manager_allocate_array_of_speed_of_sounds(
mgis_bv_MaterialDataManager*const);
/*!
* \param[in] d: material data manager
* \param[in] p: pointer to a memory buffer
* \param[in] s: size of the a memory buffer
*/
MGIS_C_EXPORT mgis_status
mgis_bv_material_data_manager_use_external_array_of_speed_of_sounds(
mgis_bv_MaterialDataManager* const, mgis_real* const, const mgis_size_type);
/*!
* \param[in] d: material data manager
*/
MGIS_C_EXPORT mgis_status
mgis_bv_material_data_manager_release_array_of_speed_of_sounds(
mgis_bv_MaterialDataManager*const);
/*!
* \brief set the state at the beginning of the time step
* \param[out] s: pointer to a pointer to the state
Expand Down
1 change: 0 additions & 1 deletion bindings/c/src/Integrate.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ mgis_status mgis_bv_integrate_2(int* const r,
const mgis_bv_Behaviour* const b) {
auto v = mgis::behaviour::make_view(*d);
auto s = mgis_bv_integrate(r, &v, b);
d->rdt = v.rdt;
return s;
} // end of mgis_bv_integrate

Expand Down
139 changes: 138 additions & 1 deletion bindings/c/src/MaterialDataManager.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,29 @@ mgis_status mgis_bv_material_data_manager_initializer_bind_tangent_operator(
return mgis_handle_cxx_exception();
}
return mgis_report_success();
} // end of mgis_bv_create_material_data_manager_initializer
} // end of mgis_bv_material_data_manager_initializer_bind_tangent_operator

mgis_status mgis_bv_material_data_manager_initializer_bind_speed_of_sound(
mgis_bv_MaterialDataManagerInitializer* d,
mgis_real* const p,
mgis_size_type s) {
if (d == nullptr) {
return mgis_report_failure(
"mgis_bv_material_data_manager_initializer_bind_speed_of_sound: "
"null argument");
}
if (p == nullptr) {
return mgis_report_failure(
"mgis_bv_material_data_manager_initializer_bind_speed_of_sound: "
"invalid tangent operator");
}
try {
d->speed_of_sound = mgis::span<mgis::real>(p, s);
} catch (...) {
return mgis_handle_cxx_exception();
}
return mgis_report_success();
} // end of mgis_bv_create_material_data_manager_initializer_bind_speed_of_sound

mgis_status mgis_bv_material_data_manager_initializer_get_state_0_initializer(
mgis_bv_MaterialStateManagerInitializer** s,
Expand Down Expand Up @@ -135,6 +157,121 @@ mgis_status mgis_bv_create_material_data_manager_with_initializer(
return mgis_report_success();
} // end of mgis_bv_create_material_data_manager_with_initializer

mgis_status mgis_bv_material_data_manager_set_thread_safe(
mgis_bv_MaterialDataManager* const d, const mgis_size_type b) {
if (d == nullptr) {
return mgis_report_failure(
"mgis_bv_material_data_manager_set_thread_safe: "
"null behaviour");
}
try {
d->setThreadSafe(static_cast<bool>(b));
} catch (...) {
return mgis_handle_cxx_exception();
}
return mgis_report_success();
} // end of mgis_bv_material_data_manager_set_thread_safe

mgis_status
mgis_bv_material_data_manager_allocate_array_of_tangent_operator_blocks(
mgis_bv_MaterialDataManager* const d) {
if (d == nullptr) {
return mgis_report_failure(
"mgis_bv_material_data_manager_set_thread_safe: "
"null behaviour");
}
try {
d->allocateArrayOfTangentOperatorBlocks();
} catch (...) {
return mgis_handle_cxx_exception();
}
return mgis_report_success();
} // end of
// mgis_bv_material_data_manager_allocate_array_of_tangent_operator_blocks

mgis_status
mgis_bv_material_data_manager_use_external_array_of_tangent_operator_blocks(
mgis_bv_MaterialDataManager* const d,
mgis_real* const p,
const mgis_size_type n) {
if (d == nullptr) {
return mgis_report_failure(
"mgis_bv_material_data_manager_set_thread_safe: "
"null behaviour");
}
try {
d->useExternalArrayOfTangentOperatorBlocks(mgis::span<mgis::real>(p, n));
} catch (...) {
return mgis_handle_cxx_exception();
}
return mgis_report_success();
} // end of
// mgis_bv_material_data_manager_use_external_array_of_tangent_operator_blocks

mgis_status
mgis_bv_material_data_manager_release_array_of_tangent_operator_blocks(
mgis_bv_MaterialDataManager* const d) {
if (d == nullptr) {
return mgis_report_failure(
"mgis_bv_material_data_manager_set_thread_safe: "
"null behaviour");
}
try {
d->releaseArrayOfTangentOperatorBlocks();
} catch (...) {
return mgis_handle_cxx_exception();
}
return mgis_report_success();
} // end of
// mgis_bv_material_data_manager_release_array_of_tangent_operator_blocks

mgis_status
mgis_bv_material_data_manager_allocate_array_of_speed_of_sounds(
mgis_bv_MaterialDataManager* const d) {
if (d == nullptr) {
return mgis_report_failure(
"mgis_bv_material_data_manager_set_thread_safe: "
"null behaviour");
}
try {
d->allocateArrayOfSpeedOfSounds();
} catch (...) {
return mgis_handle_cxx_exception();
}
return mgis_report_success();
} // end of mgis_bv_material_data_manager_allocate_array_of_speed_of_sounds

mgis_status mgis_bv_material_data_manager_use_external_array_of_speed_of_sounds(
mgis_bv_MaterialDataManager* const d,
mgis_real* const p,
const mgis_size_type n) {
if (d == nullptr) {
return mgis_report_failure(
"mgis_bv_material_data_manager_set_thread_safe: "
"null behaviour");
}
try {
d->useExternalArrayOfSpeedOfSounds(mgis::span<mgis::real>(p, n));
} catch (...) {
return mgis_handle_cxx_exception();
}
return mgis_report_success();
} // end of mgis_bv_material_data_manager_use_external_array_of_speed_of_sounds

mgis_status mgis_bv_material_data_manager_release_array_of_speed_of_sounds(
mgis_bv_MaterialDataManager* const d) {
if (d == nullptr) {
return mgis_report_failure(
"mgis_bv_material_data_manager_set_thread_safe: "
"null behaviour");
}
try {
d->releaseArrayOfSpeedOfSounds();
} catch (...) {
return mgis_handle_cxx_exception();
}
return mgis_report_success();
} // end of mgis_bv_material_data_manager_release_array_of_speed_of_sounds
mgis_status mgis_bv_material_data_manager_get_state_0(
mgis_bv_MaterialStateManager** s, mgis_bv_MaterialDataManager* const d) {
if (d == nullptr) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ namespace mgis {
* - sy2: defined by the points satisfying y==1
*/
MGIS_VISIBILITY_EXPORT
std::map<std::string, std::shared_ptr<dolfin::SubDomain>>
getUnitSquareBoundaries();
std::map<std::string, std::shared_ptr<dolfin::SubDomain>>
getUnitSquareBoundaries();
/*!
* \return all the boundaries associated with a unit cube
* The following boundaries are defined:
Expand All @@ -65,8 +65,8 @@ namespace mgis {
* - sz2: defined by the points satisfying z==1
*/
MGIS_VISIBILITY_EXPORT
std::map<std::string, std::shared_ptr<dolfin::SubDomain>>
getUnitCubeBoundaries();
std::map<std::string, std::shared_ptr<dolfin::SubDomain>>
getUnitCubeBoundaries();

} // end of namespace fenics

Expand Down
Loading

0 comments on commit 3261926

Please sign in to comment.