Skip to content

Commit

Permalink
added new constructors and updating aux_js.cpp to use enums, etc
Browse files Browse the repository at this point in the history
  • Loading branch information
justinlaughlin committed Aug 15, 2024
1 parent 2b8a8ec commit 6aba53a
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 10 deletions.
19 changes: 10 additions & 9 deletions lib/aux_js.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ using namespace mfem;
// display a new stream
// field_type: 0 - scalar data, 1 - vector data, 2 - mesh only, (-1) - unknown
//
int display(const int field_type, std::stringstream & commands, const int w,
StreamState::FieldType display(const StreamState::FieldType field_type,
std::stringstream & commands,
const int w,
const int h)
{
// reset antialiasing
Expand Down Expand Up @@ -180,8 +182,7 @@ int display(const int field_type, std::stringstream & commands, const int w,
{
if (stream_state.grid_f)
{
stream_state.grid_f
= ProjectVectorFEGridFunction(std::move(stream_state.grid_f));
stream_state.ProjectVectorFEGridFunction();
vs = new VisualizationSceneVector3d(*stream_state.grid_f);
}
else
Expand All @@ -198,7 +199,7 @@ int display(const int field_type, std::stringstream & commands, const int w,
if (stream_state.grid_f)
{
vs->AutoRefine();
vs->SetShading(2, true);
vs->SetShading(VisualizationSceneScalarData::Shading::Noncomforming, true);
}
if (mesh_range > 0.0)
{
Expand All @@ -207,11 +208,11 @@ int display(const int field_type, std::stringstream & commands, const int w,
}
if (stream_state.mesh->SpaceDimension() == 2 && field_type == 2)
{
SetVisualizationScene(vs, 2);
SetVisualizationScene(vs, 2, stream_state.keys.c_str());
}
else
{
SetVisualizationScene(vs, 3);
SetVisualizationScene(vs, 3, stream_state.keys.c_str());
}
}

Expand All @@ -234,7 +235,7 @@ int display(const int field_type, std::stringstream & commands, const int w,
// each string in streams must start with `parallel <nproc> <rank>'
//
using StringArray = std::vector<std::string>;
int processParallelStreams(StreamState & state, const StringArray & streams,
StreamState::FieldType processParallelStreams(StreamState & state, const StringArray & streams,
std::stringstream * commands = nullptr)
{
// std::cerr << "got " << streams.size() << " streams" << std::endl;
Expand All @@ -252,7 +253,7 @@ int processParallelStreams(StreamState & state, const StringArray & streams,
istreams[i] = std::unique_ptr<std::istream>(&sstreams[i]);
}

const int field_type = state.ReadStreams(istreams);
const StreamState::FieldType field_type = state.ReadStreams(istreams);

if (commands)
{
Expand All @@ -274,7 +275,7 @@ int displayParallelStreams(const StringArray & streams, const int w,
const int h)
{
std::stringstream commands(streams[0]);
const int field_type = processParallelStreams(stream_state, streams, &commands);
const StreamState::FieldType field_type = processParallelStreams(stream_state, streams, &commands);
return display(field_type, commands, w, h);
}

Expand Down
6 changes: 6 additions & 0 deletions lib/vssolution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,12 @@ VisualizationSceneSolution::VisualizationSceneSolution()
v_normals = NULL;
}

VisualizationSceneSolution::VisualizationSceneSolution(
Mesh &m, Vector &s, Vector *normals)
: VisualizationSceneSolution(m, s, NULL, normals)
{
}

VisualizationSceneSolution::VisualizationSceneSolution(
Mesh &m, Vector &s, Mesh *mc, Vector *normals)
{
Expand Down
1 change: 1 addition & 0 deletions lib/vssolution.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ class VisualizationSceneSolution : public VisualizationSceneScalarData
Array<int> el_attr_to_show, bdr_el_attr_to_show;

VisualizationSceneSolution();
VisualizationSceneSolution(Mesh &m, Vector &s, Vector *normals);
VisualizationSceneSolution(Mesh &m, Vector &s, Mesh *mc = NULL,
Vector *normals = NULL);

Expand Down
2 changes: 1 addition & 1 deletion lib/vssolution3d.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class VisualizationSceneSolution3d : public VisualizationSceneScalarData
Array<int> bdr_attr_to_show;

VisualizationSceneSolution3d();
VisualizationSceneSolution3d(Mesh & m, Vector & s, Mesh *mc);
VisualizationSceneSolution3d(Mesh & m, Vector & s, Mesh *mc = NULL);

void SetGridFunction (GridFunction *gf) { GridF = gf; }

Expand Down

0 comments on commit 6aba53a

Please sign in to comment.