GLVis  v4.2
Accurate and flexible finite element visualization
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
vsvector.hpp
Go to the documentation of this file.
1 // Copyright (c) 2010-2022, Lawrence Livermore National Security, LLC. Produced
2 // at the Lawrence Livermore National Laboratory. All Rights reserved. See files
3 // LICENSE and NOTICE for details. LLNL-CODE-443271.
4 //
5 // This file is part of the GLVis visualization tool and library. For more
6 // information and source code availability see https://glvis.org.
7 //
8 // GLVis is free software; you can redistribute it and/or modify it under the
9 // terms of the BSD-3 license. We welcome feedback and contributions, see file
10 // CONTRIBUTING.md for details.
11 
12 #ifndef GLVIS_VSVECTOR_HPP
13 #define GLVIS_VSVECTOR_HPP
14 
15 #include "mfem.hpp"
16 #include "gl/types.hpp"
17 #include "vssolution.hpp"
18 using namespace mfem;
19 
21 {
22 protected:
23 
24  Vector *solx, *soly;
25  int drawdisp, drawvector;
26 
29  GridFunction *VecGridF;
30 
31  void Init();
32 
33  virtual void GetRefinedValues(int i, const IntegrationRule &ir,
34  Vector &vals, DenseMatrix &tr);
35  virtual int GetRefinedValuesAndNormals(int i, const IntegrationRule &ir,
36  Vector &vals, DenseMatrix &tr,
37  DenseMatrix &normals);
38 
39  double (*Vec2Scalar)(double, double);
40 
41  void DrawVector(double, double, double, double, double);
42 
43  double maxlen;
44 
45  Vector vc0;
46  IsoparametricTransformation T0;
47 
48 public:
49  VisualizationSceneVector(Mesh &m, Vector &sx, Vector &sy);
50  VisualizationSceneVector(GridFunction &vgf);
51 
52  void NewMeshAndSolution(GridFunction &vgf);
53 
54  virtual ~VisualizationSceneVector();
55 
56  virtual std::string GetHelpString() const;
57 
58  void NPressed();
59  void PrepareDisplacedMesh();
60  virtual void PrepareLines()
61  { VisualizationSceneSolution::PrepareLines(); PrepareDisplacedMesh(); }
62 
63  virtual void ToggleDrawElems();
64 
65  virtual void PrepareVectorField();
66  void ToggleVectorField();
67 
69  {
70  drawdisp = (drawdisp+1)%4;
71  if (drawdisp != 1)
72  {
73  PrepareDisplacedMesh();
74  }
75  }
76 
77  virtual gl3::SceneInfo GetSceneObjs();
78 
79  virtual void glTF_Export();
80 
81  virtual void EventUpdateColors() { Prepare(); PrepareVectorField(); }
82 
83  // refinement factor for the vectors
85 
86  double ArrowScale;
87 
88  void CycleVec2Scalar(int print = 0);
89 };
90 
91 #endif
GridFunction * VecGridF
Definition: vsvector.hpp:29
gl3::GlDrawable displine_buf
Definition: vsvector.hpp:28
IsoparametricTransformation T0
Definition: vsvector.hpp:46
virtual void PrepareLines()
Definition: vsvector.hpp:60
gl3::GlDrawable vector_buf
Definition: vsvector.hpp:27
virtual void EventUpdateColors()
Definition: vsvector.hpp:81