Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/Code/CMake"
#-----------------------------------------------------------------------------

#-----------------------------------------------------------------------------

# CMake Includes
include(CheckLibraryExists)
include(GetPrerequisites)
Expand Down
30 changes: 26 additions & 4 deletions Code/Source/solver/ComMod.h
Original file line number Diff line number Diff line change
Expand Up @@ -611,18 +611,40 @@ class faceType
double qmTRI3 = 2.0/3.0;
};

/// @brief Store options for output types.
//
struct OutputOptions {
bool boundary_integral = false;
bool spatial = false;
bool volume_integral = false;

bool no_options_set() {
return !(boundary_integral | spatial | volume_integral);
}

void set_option(consts::OutputType type, bool value)
{
if (type == consts::OutputType::boundary_integral) {
boundary_integral = value;
} else if (type == consts::OutputType::spatial) {
spatial = value;
} else if (type == consts::OutputType::volume_integral) {
volume_integral = value;
}
}
};

/// @brief Declared type for outputed variables
//
class outputType
{
public:

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

// The group that this belong to (one of outType_*)
consts::OutputType grp = consts::OutputType::outGrp_NA;
//int grp;
consts::OutputNameType grp = consts::OutputNameType::outGrp_NA;

// Length of the outputed variable
int l = 0;
Expand Down
3 changes: 2 additions & 1 deletion Code/Source/solver/all_fun.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,8 @@ double integ(const ComMod& com_mod, const CmMod& cm_mod, int dId, const Array<do

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

bool isIB = false;
Expand Down
10 changes: 10 additions & 0 deletions Code/Source/solver/consts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,16 @@ const std::map<std::string,EquationType> equation_name_to_type = {

};

// Map from output type string to OutputType.
//
const std::map<std::string,OutputType> output_type_name_to_type = {
{"B_INT", OutputType::boundary_integral},
{"Boundary_integral", OutputType::boundary_integral},
{"Spatial", OutputType::spatial},
{"V_INT", OutputType::volume_integral},
{"Volume_integral", OutputType::volume_integral}
};

const std::map<std::string,MeshGeneratorType> mesh_generator_name_to_type = {
{"Tetgen", MeshGeneratorType::RMSH_TETGEN},
{"Meshsim", MeshGeneratorType::RMSH_MESHSIM}
Expand Down
14 changes: 12 additions & 2 deletions Code/Source/solver/consts.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ int enum_int(T value)
return static_cast<int>(value);
}


/// Check if a value is set to infinity.
template<typename T>
bool present(T value)
Expand Down Expand Up @@ -332,7 +331,7 @@ enum class MeshGeneratorType
/// Map for string to MeshGeneratorType.
extern const std::map<std::string,MeshGeneratorType> mesh_generator_name_to_type;

enum class OutputType
enum class OutputNameType
{
outGrp_NA = 500,
outGrp_A = 501,
Expand Down Expand Up @@ -391,6 +390,17 @@ enum class OutputType
out_CGInv1 = 572
};

/// @brief Simulation output file types.
//
enum class OutputType
{
boundary_integral,
spatial,
volume_integral
};

extern const std::map<std::string,OutputType> output_type_name_to_type;

/// @brief Possible physical properties. Current maxNPror is 20.
//
enum class PhysicalProperyType
Expand Down
7 changes: 5 additions & 2 deletions Code/Source/solver/distribute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -942,7 +942,7 @@ void dist_eq(ComMod& com_mod, const CmMod& cm_mod, const cmType& cm, const std::
{
using namespace consts;

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

for (int iOut = 0; iOut < lEq.nOutput; iOut++) {
auto& output = lEq.output[iOut];
cm.bcast(cm_mod, output.wtn);
cm.bcast_enum(cm_mod, &output.grp);
cm.bcast(cm_mod, &output.o);
cm.bcast(cm_mod, &output.l);
cm.bcast(cm_mod, output.name);

cm.bcast(cm_mod, &output.options.boundary_integral);
cm.bcast(cm_mod, &output.options.spatial);
cm.bcast(cm_mod, &output.options.volume_integral);
}

// Distribute BC information
Expand Down
Loading
Loading