Skip to content

Commit 6ecb75f

Browse files
authored
Boundary integral file time step 309 (SimVascular#313)
* Change file name. * Add functionality to write integral quantities and replace using wtn Boolean vector. * Remove initialization of output type options to true. * Fix test for integrals. * Remove redundant loop.
1 parent 639b114 commit 6ecb75f

File tree

16 files changed

+535
-446
lines changed

16 files changed

+535
-446
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/Code/CMake"
6464
#-----------------------------------------------------------------------------
6565

6666
#-----------------------------------------------------------------------------
67+
6768
# CMake Includes
6869
include(CheckLibraryExists)
6970
include(GetPrerequisites)

Code/Source/solver/ComMod.h

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -611,18 +611,40 @@ class faceType
611611
double qmTRI3 = 2.0/3.0;
612612
};
613613

614+
/// @brief Store options for output types.
615+
//
616+
struct OutputOptions {
617+
bool boundary_integral = false;
618+
bool spatial = false;
619+
bool volume_integral = false;
620+
621+
bool no_options_set() {
622+
return !(boundary_integral | spatial | volume_integral);
623+
}
624+
625+
void set_option(consts::OutputType type, bool value)
626+
{
627+
if (type == consts::OutputType::boundary_integral) {
628+
boundary_integral = value;
629+
} else if (type == consts::OutputType::spatial) {
630+
spatial = value;
631+
} else if (type == consts::OutputType::volume_integral) {
632+
volume_integral = value;
633+
}
634+
}
635+
};
636+
614637
/// @brief Declared type for outputed variables
615638
//
616639
class outputType
617640
{
618641
public:
619642

620-
// Is this output suppose to be written into VTK, boundary, vol
621-
std::vector<bool> wtn{false, false, false};
643+
// Options to write various output types.
644+
OutputOptions options;
622645

623646
// The group that this belong to (one of outType_*)
624-
consts::OutputType grp = consts::OutputType::outGrp_NA;
625-
//int grp;
647+
consts::OutputNameType grp = consts::OutputNameType::outGrp_NA;
626648

627649
// Length of the outputed variable
628650
int l = 0;

Code/Source/solver/all_fun.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,8 @@ double integ(const ComMod& com_mod, const CmMod& cm_mod, int dId, const Array<do
346346

347347
bool flag = pFlag;
348348
if (l != u) {
349-
throw std::runtime_error("Incompatible spatial output setting and element type");
349+
std::string msg = " l=" + std::to_string(l) + " u=" + std::to_string(u);
350+
throw std::runtime_error("Incompatible spatial output setting and element type." + msg);
350351
}
351352

352353
bool isIB = false;

Code/Source/solver/consts.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,16 @@ const std::map<std::string,EquationType> equation_name_to_type = {
216216

217217
};
218218

219+
// Map from output type string to OutputType.
220+
//
221+
const std::map<std::string,OutputType> output_type_name_to_type = {
222+
{"B_INT", OutputType::boundary_integral},
223+
{"Boundary_integral", OutputType::boundary_integral},
224+
{"Spatial", OutputType::spatial},
225+
{"V_INT", OutputType::volume_integral},
226+
{"Volume_integral", OutputType::volume_integral}
227+
};
228+
219229
const std::map<std::string,MeshGeneratorType> mesh_generator_name_to_type = {
220230
{"Tetgen", MeshGeneratorType::RMSH_TETGEN},
221231
{"Meshsim", MeshGeneratorType::RMSH_MESHSIM}

Code/Source/solver/consts.h

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ int enum_int(T value)
6161
return static_cast<int>(value);
6262
}
6363

64-
6564
/// Check if a value is set to infinity.
6665
template<typename T>
6766
bool present(T value)
@@ -332,7 +331,7 @@ enum class MeshGeneratorType
332331
/// Map for string to MeshGeneratorType.
333332
extern const std::map<std::string,MeshGeneratorType> mesh_generator_name_to_type;
334333

335-
enum class OutputType
334+
enum class OutputNameType
336335
{
337336
outGrp_NA = 500,
338337
outGrp_A = 501,
@@ -391,6 +390,17 @@ enum class OutputType
391390
out_CGInv1 = 572
392391
};
393392

393+
/// @brief Simulation output file types.
394+
//
395+
enum class OutputType
396+
{
397+
boundary_integral,
398+
spatial,
399+
volume_integral
400+
};
401+
402+
extern const std::map<std::string,OutputType> output_type_name_to_type;
403+
394404
/// @brief Possible physical properties. Current maxNPror is 20.
395405
//
396406
enum class PhysicalProperyType

Code/Source/solver/distribute.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -942,7 +942,7 @@ void dist_eq(ComMod& com_mod, const CmMod& cm_mod, const cmType& cm, const std::
942942
{
943943
using namespace consts;
944944

945-
#define n_dist_eq
945+
#define ndist_eq
946946
#ifdef dist_eq
947947
DebugMsg dmsg(__func__, com_mod.cm.idcm());
948948
dmsg.banner();
@@ -1122,11 +1122,14 @@ void dist_eq(ComMod& com_mod, const CmMod& cm_mod, const cmType& cm, const std::
11221122

11231123
for (int iOut = 0; iOut < lEq.nOutput; iOut++) {
11241124
auto& output = lEq.output[iOut];
1125-
cm.bcast(cm_mod, output.wtn);
11261125
cm.bcast_enum(cm_mod, &output.grp);
11271126
cm.bcast(cm_mod, &output.o);
11281127
cm.bcast(cm_mod, &output.l);
11291128
cm.bcast(cm_mod, output.name);
1129+
1130+
cm.bcast(cm_mod, &output.options.boundary_integral);
1131+
cm.bcast(cm_mod, &output.options.spatial);
1132+
cm.bcast(cm_mod, &output.options.volume_integral);
11301133
}
11311134

11321135
// Distribute BC information

0 commit comments

Comments
 (0)