Theseus
Compressible flow solver
Loading...
Searching...
No Matches
GasState.hpp
Go to the documentation of this file.
1// Copyright (c) 2025-2026 Board of Trustees of the University of Illinois
2//
3// This file is part of Theseus.
4//
5// SPDX-License-Identifier: BSD-3-Clause
6#pragma once
7#include <cassert>
8// StateLayout and State Views for Gas Simulations
9//
10// Goal:
11// - Centralize the mapping from (equation, dof) -> flat index
12// - Provide indices and offsets for accessing model-specific
13// quantities from the solution data
14// - Provide general field-level view for future use
15//
16// Layout assumption (canonical, matches current code):
17// Note that potentially we will change rho --> rho*Y_alpha.
18// U(eq, dof) is currently stored as equation-blocked:
19// U = [ rho (block 0)
20// | rho*u_x (block 1)
21// | rho*u_y (block 2, if dim > 1)
22// | rho*u_z (block 3, if dim > 2)
23// | rho*E (block dim+1)
24// | scalars (maybe/future, blocks dim+2:nspecies+dim+1) ]
25//
26// Each block has length = num_dofs_scalar (wrt mesh or element)
27//
28#include "theseus_kernels.hpp"
29
30namespace Theseus
31{
32 // -----------------------------------------------------------------------------
33 // StateLayout: single point to define how state storage is arranged
34 // -----------------------------------------------------------------------------
35
37 {
38 int dim; // spatial dimension (1,2,3)
39 int num_dofs_scalar; // DOFs per scalar field (block length)
40
41 // Equation indices (0-based)
42 int eq_mass; // mass density
43 int eq_mom0; // first component of momentum
44 int eq_mom[3]; // momentum density components: x,y,z
45 int eq_energy; // total energy density
46
47 // Optional scalar support (forward-looking)
48 int eq_scalar0; // index of first scalar component (or -1 if none)
49 int num_scalars; // number of scalar components
50
51 MFEM_HOST_DEVICE StateLayout() = default;
69 void setup(int dim_, int num_dofs_scalar_, int num_scalars_ = 0)
70 {
71 dim = dim_;
72 num_dofs_scalar = num_dofs_scalar_;
73 eq_mass = 0;
74 eq_energy = dim_ + 1;
75 eq_scalar0 = (num_scalars_ > 0 ? (dim_ + 2) : -1);
76 num_scalars = num_scalars_;
77 // Momentum components follow mass
78 eq_mom0 = 1;
79 for (int d = 0; d < 3; ++d)
80 {
81 eq_mom[d] = (d < dim_) ? (1 + d) : -1;
82 }
83 }
84
85 // Canonical ordering:
86 // [rho, rho*u_0,-, rho*u_(dim-1), rho*E, scalars-]
87 StateLayout(int dim_, int num_dofs_scalar_, int num_scalars_ = 0)
88 { setup(dim_, num_dofs_scalar_, num_scalars_);}
89
90 // Convenience for nequations
91 MFEM_HOST_DEVICE inline int nequations() const
92 { return dim + 2 + num_scalars; }
93
94 // parameter validation routine
95 MFEM_HOST_DEVICE inline int validate(int equation, int dof) const
96 {
97 return ((equation < nequations() && dof < num_dofs_scalar &&
98 equation > -1 && dof > -1) ? 0 : 1);
99 }
100
101 // Flat index into the equation-blocked vector
102 MFEM_HOST_DEVICE inline int index(int equation, int dof) const
103 {
104 assert(validate(equation, dof) == 0);
105 return equation * num_dofs_scalar + dof;
106 }
107 };
108
109 // -----------------------------------------------------------------------------
110 // PointStateView: per-point view (immediate refactor tool).
111 //
112 // Usage pattern:
113 //
114 // Vector state = [rho, rhoVx, rhoVy, rhoVz, rhoE]
115 // const mfem::real_t *q = state.GetData();
116 // PointStateView S{state.GetData()};
117 // double rho = S.mass(layout);
118 // double rhoU = S.momentum(layout, 0);
119 // double rhoE = S.energy(layout);
120 //
121 // double rho = q[layout.eq_mass]; (same thing)
122 //
123 //
124 // This is a small, value-type-like view with correct indexing.
125 // -----------------------------------------------------------------------------
127 {
128 const mfem::real_t* U; // packed state data -> [rho, rhoVx, rhoVy, ..., rhoE]
129
130 MFEM_HOST_DEVICE explicit PointStateView(const mfem::real_t* U_)
131 : U(U_)
132 { }
133
134 MFEM_HOST_DEVICE inline bool is_valid() const
135 {
136 return (U != nullptr);
137 }
138
139 // Mass / density
140 MFEM_HOST_DEVICE inline mfem::real_t mass(const StateLayout &L) const
141 {
142 const mfem::real_t rho = U[ L.eq_mass ];
143 return rho;
144 }
145
146 // Momentum components: d = 0(x),1(y),2(z)
147 MFEM_HOST_DEVICE inline mfem::real_t momentum(const StateLayout &L, int d) const
148 {
149 assert(d < L.dim);
150 return U[ L.eq_mom[d] ];
151 }
152
153 MFEM_HOST_DEVICE inline mfem::real_t momentum_x(const StateLayout &L) const
154 {
155 return momentum(L, 0);
156 }
157
158 MFEM_HOST_DEVICE inline mfem::real_t momentum_y(const StateLayout &L) const
159 {
160 return momentum(L, 1);
161 }
162
163 MFEM_HOST_DEVICE inline mfem::real_t momentum_z(const StateLayout &L) const
164 {
165 return momentum(L, 2);
166 }
167
168 // Velocity components: d = 0(x),1(y),2(z)
169 MFEM_HOST_DEVICE inline mfem::real_t velocity(const StateLayout &L, int d) const
170 {
171 return momentum(L, d) / mass(L);
172 }
173
174 MFEM_HOST_DEVICE inline mfem::real_t velocity_x(const StateLayout &L) const
175 {
176 return momentum_x(L) / mass(L);
177 }
178
179 MFEM_HOST_DEVICE inline mfem::real_t velocity_y(const StateLayout &L) const
180 {
181 return momentum_y(L) / mass(L);
182 }
183
184 MFEM_HOST_DEVICE inline mfem::real_t velocity_z(const StateLayout &L) const
185 {
186 return momentum_z(L) / mass(L);
187 }
188
189 // Total energy
190 MFEM_HOST_DEVICE inline mfem::real_t energy(const StateLayout &L) const
191 {
192 return U[ L.eq_energy ];
193 }
194
195 // Scalar components, if present
196 MFEM_HOST_DEVICE inline mfem::real_t scalar(const StateLayout &L, int k) const
197 {
198 assert(L.num_scalars > 0);
199 assert((k >= 0 && k < L.num_scalars) && "Invalid scalar index");
200 return U[ L.eq_scalar0 + k ];
201 }
202 };
203
204 // -----------------------------------------------------------------------------
205 // PointStateViewRW: *writeable* per-point view
206 //
207 // Usage pattern:
208 //
209 // Vector state = [rho, rhoVx, rhoVy, rhoVz, rhoE]
210 // PointStateView S{state.GetData()};
211 // double rho = S.mass(layout);
212 // double rhoU = S.momentum(layout, 0);
213 // double rhoE = S.energy(layout);
214 //
215 // This is a small, value-type-like view with correct indexing.
216 // -----------------------------------------------------------------------------
218 {
219 mfem::real_t* U; // packed state data -> [rho, rhoVx, rhoVy, ..., rhoE]
220
221 MFEM_HOST_DEVICE
222 PointStateViewRW(mfem::real_t* U_)
223 : U(U_)
224 { }
225
226 MFEM_HOST_DEVICE inline bool is_valid() const
227 {
228 return (U != nullptr);
229 }
230
231 // Mass density
232 MFEM_HOST_DEVICE inline mfem::real_t mass(const StateLayout &L) const
233 {
234 const mfem::real_t rho = U[ L.eq_mass ];
235 return rho;
236 }
237
238 // Set Mass density
239 MFEM_HOST_DEVICE inline void set_mass(const StateLayout &L, mfem::real_t val)
240 {
241 U[ L.eq_mass ] = val;
242 }
243
244 // Momentum components: d = 0(x),1(y),2(z)
245 MFEM_HOST_DEVICE inline mfem::real_t momentum(const StateLayout &L, int d) const
246 {
247 assert(d < L.dim);
248 return U[ L.eq_mom[d] ];
249 }
250
251 // Set Momentum components: d = 0(x),1(y),2(z)
252 MFEM_HOST_DEVICE inline void set_momentum(const StateLayout &L, int d, mfem::real_t val)
253 {
254 assert(d < L.dim);
255 U[ L.eq_mom[d] ] = val;
256 }
257
258 MFEM_HOST_DEVICE inline mfem::real_t momentum_x(const StateLayout &L) const
259 {
260 return momentum(L, 0);
261 }
262
263 MFEM_HOST_DEVICE inline mfem::real_t momentum_y(const StateLayout &L) const
264 {
265 return momentum(L, 1);
266 }
267
268 MFEM_HOST_DEVICE inline mfem::real_t momentum_z(const StateLayout &L) const
269 {
270 return momentum(L, 2);
271 }
272
273 // Velocity components: d = 0(x),1(y),2(z)
274 MFEM_HOST_DEVICE inline mfem::real_t velocity(const StateLayout &L, int d) const
275 {
276 return momentum(L, d) / mass(L);
277 }
278
279 MFEM_HOST_DEVICE inline mfem::real_t velocity_x(const StateLayout &L) const
280 {
281 return momentum_x(L) / mass(L);
282 }
283
284 MFEM_HOST_DEVICE inline mfem::real_t velocity_y(const StateLayout &L) const
285 {
286 return momentum_y(L) / mass(L);
287 }
288
289 MFEM_HOST_DEVICE inline mfem::real_t velocity_z(const StateLayout &L) const
290 {
291 return momentum_z(L) / mass(L);
292 }
293
294 // Total energy
295 MFEM_HOST_DEVICE inline mfem::real_t energy(const StateLayout &L) const
296 {
297 return U[ L.eq_energy ];
298 }
299
300 // Set Total energy
301 MFEM_HOST_DEVICE inline void set_energy(const StateLayout &L, mfem::real_t val)
302 {
303 U[ L.eq_energy ] = val;
304 }
305
306 // Scalar components, if present
307 MFEM_HOST_DEVICE inline mfem::real_t scalar(const StateLayout &L, int k) const
308 {
309 assert(L.num_scalars > 0);
310 assert((k >= 0 && k < L.num_scalars) && "Invalid scalar index");
311 return U[ L.eq_scalar0 + k ];
312 }
313
314 // Set Scalar components, if present
315 MFEM_HOST_DEVICE inline void set_scalar(const StateLayout &L, int k, mfem::real_t val)
316 {
317 assert(L.num_scalars > 0);
318 assert((k >= 0 && k < L.num_scalars) && "Invalid scalar index");
319 U[ L.eq_scalar0 + k ] = val;
320 }
321
322 };
323
324 // -----------------------------------------------------------------------------
325 // PointPrimitiveView: per-point view
326 //
327 // Usage pattern:
328 //
329 // Vector state = [rho, Vx, Vy, Vz, p]
330 // PointStateView S{state.GetData()};
331 // double rho = S.mass(layout);
332 // double Vx = S.velocity(layout, 0);
333 // double Vy = S.velocity(layout, 1);
334 // double p = S.pressure(layout);
335 //
336 // This is a small, value-type-like view with correct indexing.
337 // -----------------------------------------------------------------------------
339 {
340 const mfem::real_t* U; // packed state data -> [rho, rhoVx, rhoVy, ..., rhoE]
341
342 MFEM_HOST_DEVICE
343 PointPrimitiveView(const mfem::real_t* U_)
344 : U(U_)
345 { }
346
347 MFEM_HOST_DEVICE inline bool is_valid() const
348 {
349 return (U != nullptr);
350 }
351
352 // Mass / density
353 MFEM_HOST_DEVICE inline mfem::real_t mass(const StateLayout &L) const
354 {
355 const mfem::real_t rho = U[ L.eq_mass ];
356 return rho;
357 }
358
359 // Array offset to velocity components
360 MFEM_HOST_DEVICE inline int velocity_loc(const StateLayout &L) const
361 {
362 return L.eq_mom0;
363 }
364 // Momentum components: d = 0(x),1(y),2(z)
365 MFEM_HOST_DEVICE inline mfem::real_t velocity(const StateLayout &L, int d) const
366 {
367 assert(d < L.dim);
368 return U[ L.eq_mom[d] ];
369 }
370
371 MFEM_HOST_DEVICE inline mfem::real_t velocity_x(const StateLayout &L) const
372 {
373 return velocity(L, 0);
374 }
375
376 MFEM_HOST_DEVICE inline mfem::real_t velocity_y(const StateLayout &L) const
377 {
378 return velocity(L, 1);
379 }
380
381 MFEM_HOST_DEVICE inline mfem::real_t velocity_z(const StateLayout &L) const
382 {
383 return velocity(L, 2);
384 }
385
386 MFEM_HOST_DEVICE inline mfem::real_t pressure(const StateLayout &L) const
387 {
388 return U[ L.eq_energy ];
389 }
390
391 // Scalar components, if present
392 MFEM_HOST_DEVICE inline mfem::real_t scalar(const StateLayout &L, int k) const
393 {
394 assert(L.num_scalars > 0);
395 assert((k >= 0 && k < L.num_scalars) && "Invalid scalar index");
396 return U[ L.eq_scalar0 + k ];
397 }
398 };
399
400 // -----------------------------------------------------------------------------
401 // PointPrimtiveViewRW: *writeable* per-point view
402 //
403 // Usage pattern:
404 //
405 // Vector state = [rho, rhoVx, rhoVy, rhoVz, rhoE]
406 // PointStateView S{state.GetData()};
407 // double r = S.mass(layout);
408 // double U = S.velocity(layout, 0);
409 // double V = S.velocity(layout, 1);
410 // double p = S.pressure(layout);
411 // S.set_pressure(layout, p);
412 //
413 // This is a small, value-type-like view with correct indexing.
414 // -----------------------------------------------------------------------------
416 {
417 mfem::real_t* U; // packed state data -> [rho, rhoVx, rhoVy, ..., rhoE]
418
419 MFEM_HOST_DEVICE
420 PointPrimitiveViewRW(mfem::real_t* U_) : U(U_) { }
421
422 MFEM_HOST_DEVICE inline bool is_valid() const
423 {
424 return (U != nullptr);
425 }
426
427 // Mass density
428 MFEM_HOST_DEVICE inline mfem::real_t mass(const StateLayout &L) const
429 {
430 const mfem::real_t rho = U[ L.eq_mass ];
431 return rho;
432 }
433
434 // Set Mass density
435 MFEM_HOST_DEVICE inline void set_mass(const StateLayout &L, mfem::real_t val)
436 {
437 U[ L.eq_mass ] = val;
438 }
439
440 // Array offset to velocity components
441 MFEM_HOST_DEVICE inline int velocity_loc(const StateLayout &L) const
442 {
443 return L.eq_mom0;
444 }
445
446 // Momentum components: d = 0(x),1(y),2(z)
447 MFEM_HOST_DEVICE inline mfem::real_t velocity(const StateLayout &L, int d) const
448 {
449 assert(d < L.dim);
450 return U[ L.eq_mom[d] ];
451 }
452
453 // Set Momentum components: d = 0(x),1(y),2(z)
454 MFEM_HOST_DEVICE inline void set_velocity(const StateLayout &L, int d, mfem::real_t val)
455 {
456 assert(d < L.dim);
457 U[ L.eq_mom[d] ] = val;
458 }
459
460 MFEM_HOST_DEVICE inline mfem::real_t velocity_x(const StateLayout &L) const
461 {
462 return velocity(L, 0);
463 }
464
465 MFEM_HOST_DEVICE inline mfem::real_t velocity_y(const StateLayout &L) const
466 {
467 return velocity(L, 1);
468 }
469
470 MFEM_HOST_DEVICE inline mfem::real_t velocity_z(const StateLayout &L) const
471 {
472 return velocity(L, 2);
473 }
474
475 MFEM_HOST_DEVICE inline mfem::real_t pressure(const StateLayout &L) const
476 {
477 return U[ L.eq_energy ];
478 }
479
480 MFEM_HOST_DEVICE inline void set_pressure(const StateLayout &L, mfem::real_t val)
481 {
482 U[ L.eq_energy ] = val;
483 }
484
485 // Scalar components, if present
486 MFEM_HOST_DEVICE inline mfem::real_t scalar(const StateLayout &L, int k) const
487 {
488 assert(L.num_scalars > 0);
489 assert((k >= 0 && k < L.num_scalars) && "Invalid scalar index");
490 return U[ L.eq_scalar0 + k ];
491 }
492
493 // Set Scalar components, if present
494 MFEM_HOST_DEVICE inline void set_scalar(const StateLayout &L, int k, mfem::real_t val)
495 {
496 assert(L.num_scalars > 0);
497 assert((k >= 0 && k < L.num_scalars) && "Invalid scalar index");
498 U[ L.eq_scalar0 + k ] = val;
499 }
500
501 };
502
503 // -----------------------------------------------------------------------------
504 // DofStateView: per-DOF view (Get conserved quantities for particular DOF)
505 //
506 // Usage pattern:
507 //
508 // const double* U = sol->Read();
509 // StateLayout layout(dim, num_dofs_scalar);
510 // for (int i = 0; i < num_dofs_scalar; ++i) {
511 // DofStateView<const double> S{U, i};
512 // double rho = S.mass(l);
513 // double rhoU = S.momentum(l, 0);
514 // double E = S.energy(l);
515 // }
516 //
517 // This is a small, value-type-like view with correct indexing.
518 // -----------------------------------------------------------------------------
520 {
521 const mfem::real_t* U; // pointer into equation-blocked storage
522 int dof; // which DOF (0 .. num_dofs_scalar-1)
523
524 MFEM_HOST_DEVICE
525 DofStateView(const mfem::real_t* U_,
526 int dof_)
527 : U(U_), dof(dof_)
528 { }
529
530 MFEM_HOST_DEVICE inline bool is_valid() const
531 {
532 return (U != nullptr);
533 }
534
535 // Mass / density
536 MFEM_HOST_DEVICE inline mfem::real_t mass(const StateLayout &L) const
537 {
538 const mfem::real_t rho = U[ L.index(L.eq_mass, dof) ];
539 return rho;
540 }
541
542 // Momentum components: d = 0(x),1(y),2(z)
543 MFEM_HOST_DEVICE inline mfem::real_t momentum(const StateLayout &L, int d) const
544 {
545 assert(d < L.dim);
546 return U[ L.index(L.eq_mom[d], dof) ];
547 }
548
549 MFEM_HOST_DEVICE inline mfem::real_t momentum_x(const StateLayout &L) const
550 {
551 return momentum(L, 0);
552 }
553
554 MFEM_HOST_DEVICE inline mfem::real_t momentum_y(const StateLayout &L) const
555 {
556 return momentum(L, 1);
557 }
558
559 MFEM_HOST_DEVICE inline mfem::real_t momentum_z(const StateLayout &L) const
560 {
561 return momentum(L, 2);
562 }
563
564 // Velocity components: d = 0(x),1(y),2(z)
565 MFEM_HOST_DEVICE inline mfem::real_t velocity(const StateLayout &L, int d) const
566 {
567 return momentum(L, d) / mass(L);
568 }
569
570 MFEM_HOST_DEVICE inline mfem::real_t velocity_x(const StateLayout &L) const
571 {
572 return velocity(L, 0);
573 }
574
575 MFEM_HOST_DEVICE inline mfem::real_t velocity_y(const StateLayout &L) const
576 {
577 return velocity(L, 1);
578 }
579
580 MFEM_HOST_DEVICE inline mfem::real_t velocity_z(const StateLayout &L) const
581 {
582 return velocity(L, 2);
583 }
584
585 // Total energy
586 MFEM_HOST_DEVICE inline mfem::real_t energy(const StateLayout &L) const
587 {
588 return U[ L.index(L.eq_energy, dof) ];
589 }
590
591 // Scalar components, if present
592 MFEM_HOST_DEVICE inline mfem::real_t scalar(const StateLayout &L, int k) const
593 {
594 assert(L.num_scalars > 0);
595 assert(k >= 0 && k < L.num_scalars && "Invalid scalar index");
596 return U[ L.index(L.eq_scalar0 + k, dof) ];
597 }
598 };
599
600 // -----------------------------------------------------------------------------
601 // FieldStateView: Field-level view.
602 //
603 // Wraps a mfem::real_t* + StateLayout and provides equation-blocked access over all DOFs.
604 // For use in loops that already use (eq, i) patterns, or when needing more general
605 // mechanism than DofStateView.
606 // -----------------------------------------------------------------------------
608 {
609 mfem::real_t* data; // raw pointer to equation-blocked storage
610
611 MFEM_HOST_DEVICE
612 FieldStateView(mfem::real_t* data_) : data(data_) { }
613
614 MFEM_HOST_DEVICE inline bool is_valid() const
615 {
616 return (data != nullptr);
617 }
618
619 // Generic access by (equation, dof)
620 MFEM_HOST_DEVICE inline mfem::real_t& u(const StateLayout &layout, int equation, int dof) const
621 {
622 return data[ layout.index(equation, dof) ];
623 }
624
625 // Named accessors for convenience
626 MFEM_HOST_DEVICE inline mfem::real_t& mass(const StateLayout &layout, int dof) const
627 {
628 return u(layout, layout.eq_mass, dof);
629 }
630
631 MFEM_HOST_DEVICE inline mfem::real_t& momentum(const StateLayout &layout, int component, int dof) const
632 {
633 return u(layout, layout.eq_mom[component], dof);
634 }
635
636 MFEM_HOST_DEVICE inline mfem::real_t& momentum_x(const StateLayout &layout, int dof) const
637 {
638 return u(layout, layout.eq_mom[0], dof);
639 }
640
641 MFEM_HOST_DEVICE inline mfem::real_t& momentum_y(const StateLayout &layout, int dof) const
642 {
643 return u(layout, layout.eq_mom[1], dof);
644 }
645
646 MFEM_HOST_DEVICE inline mfem::real_t& momentum_z(const StateLayout &layout, int dof) const
647 {
648 return u(layout, layout.eq_mom[2], dof);
649 }
650
651 MFEM_HOST_DEVICE inline mfem::real_t velocity(const StateLayout &layout, int component, int dof) const
652 {
653 return momentum(layout, component, dof) / mass(layout, dof);
654 }
655
656 MFEM_HOST_DEVICE inline mfem::real_t velocity_x(const StateLayout &layout, int dof) const
657 {
658 return velocity(layout, 0, dof);
659 }
660
661 MFEM_HOST_DEVICE inline mfem::real_t velocity_y(const StateLayout &layout, int dof) const
662 {
663 return velocity(layout, 1, dof);
664 }
665
666 MFEM_HOST_DEVICE inline mfem::real_t velocity_z(const StateLayout &layout, int dof) const
667 {
668 return velocity(layout, 2, dof);
669 }
670
671 MFEM_HOST_DEVICE inline mfem::real_t& energy(const StateLayout &layout, int dof) const
672 {
673 return u(layout, layout.eq_energy, dof);
674 }
675
676 MFEM_HOST_DEVICE inline mfem::real_t& scalar(const StateLayout &layout, int k, int dof) const
677 {
678 assert(layout.num_scalars > 0);
679 assert(k >= 0 && k < layout.num_scalars && "Invalid scalar index");
680 return u(layout, layout.eq_scalar0 + k, dof);
681 }
682 };
683
684 inline int offset_mass (const Theseus::StateLayout &L) { return L.index(L.eq_mass, 0); }
685 inline int offset_momentum (const Theseus::StateLayout &L) { return L.index(L.eq_mom0, 0); }
686 inline int offset_energy (const Theseus::StateLayout &L) { return L.index(L.eq_energy, 0); }
687 inline int offset_scalars (const Theseus::StateLayout &L) { return L.index(L.eq_scalar0, 0); };
688
689} // namespace Theseus
Definition AxisymmetricGeometry.hpp:15
int offset_scalars(const Theseus::StateLayout &L)
Definition GasState.hpp:687
int offset_energy(const Theseus::StateLayout &L)
Definition GasState.hpp:686
int offset_mass(const Theseus::StateLayout &L)
Definition GasState.hpp:684
int offset_momentum(const Theseus::StateLayout &L)
Definition GasState.hpp:685
Definition GasState.hpp:520
MFEM_HOST_DEVICE mfem::real_t velocity_y(const StateLayout &L) const
Definition GasState.hpp:575
MFEM_HOST_DEVICE mfem::real_t momentum_y(const StateLayout &L) const
Definition GasState.hpp:554
MFEM_HOST_DEVICE mfem::real_t momentum_z(const StateLayout &L) const
Definition GasState.hpp:559
MFEM_HOST_DEVICE mfem::real_t velocity(const StateLayout &L, int d) const
Definition GasState.hpp:565
MFEM_HOST_DEVICE mfem::real_t momentum(const StateLayout &L, int d) const
Definition GasState.hpp:543
int dof
Definition GasState.hpp:522
MFEM_HOST_DEVICE mfem::real_t momentum_x(const StateLayout &L) const
Definition GasState.hpp:549
MFEM_HOST_DEVICE mfem::real_t velocity_z(const StateLayout &L) const
Definition GasState.hpp:580
MFEM_HOST_DEVICE DofStateView(const mfem::real_t *U_, int dof_)
Definition GasState.hpp:525
const mfem::real_t * U
Definition GasState.hpp:521
MFEM_HOST_DEVICE mfem::real_t energy(const StateLayout &L) const
Definition GasState.hpp:586
MFEM_HOST_DEVICE mfem::real_t scalar(const StateLayout &L, int k) const
Definition GasState.hpp:592
MFEM_HOST_DEVICE mfem::real_t mass(const StateLayout &L) const
Definition GasState.hpp:536
MFEM_HOST_DEVICE bool is_valid() const
Definition GasState.hpp:530
MFEM_HOST_DEVICE mfem::real_t velocity_x(const StateLayout &L) const
Definition GasState.hpp:570
Definition GasState.hpp:608
MFEM_HOST_DEVICE mfem::real_t & momentum(const StateLayout &layout, int component, int dof) const
Definition GasState.hpp:631
MFEM_HOST_DEVICE mfem::real_t & momentum_y(const StateLayout &layout, int dof) const
Definition GasState.hpp:641
MFEM_HOST_DEVICE mfem::real_t velocity_x(const StateLayout &layout, int dof) const
Definition GasState.hpp:656
MFEM_HOST_DEVICE FieldStateView(mfem::real_t *data_)
Definition GasState.hpp:612
MFEM_HOST_DEVICE mfem::real_t & scalar(const StateLayout &layout, int k, int dof) const
Definition GasState.hpp:676
MFEM_HOST_DEVICE mfem::real_t & momentum_z(const StateLayout &layout, int dof) const
Definition GasState.hpp:646
MFEM_HOST_DEVICE bool is_valid() const
Definition GasState.hpp:614
MFEM_HOST_DEVICE mfem::real_t & energy(const StateLayout &layout, int dof) const
Definition GasState.hpp:671
MFEM_HOST_DEVICE mfem::real_t & momentum_x(const StateLayout &layout, int dof) const
Definition GasState.hpp:636
MFEM_HOST_DEVICE mfem::real_t velocity_y(const StateLayout &layout, int dof) const
Definition GasState.hpp:661
mfem::real_t * data
Definition GasState.hpp:609
MFEM_HOST_DEVICE mfem::real_t & mass(const StateLayout &layout, int dof) const
Definition GasState.hpp:626
MFEM_HOST_DEVICE mfem::real_t velocity_z(const StateLayout &layout, int dof) const
Definition GasState.hpp:666
MFEM_HOST_DEVICE mfem::real_t & u(const StateLayout &layout, int equation, int dof) const
Definition GasState.hpp:620
MFEM_HOST_DEVICE mfem::real_t velocity(const StateLayout &layout, int component, int dof) const
Definition GasState.hpp:651
Definition GasState.hpp:416
MFEM_HOST_DEVICE mfem::real_t velocity(const StateLayout &L, int d) const
Definition GasState.hpp:447
MFEM_HOST_DEVICE bool is_valid() const
Definition GasState.hpp:422
MFEM_HOST_DEVICE void set_mass(const StateLayout &L, mfem::real_t val)
Definition GasState.hpp:435
MFEM_HOST_DEVICE PointPrimitiveViewRW(mfem::real_t *U_)
Definition GasState.hpp:420
MFEM_HOST_DEVICE mfem::real_t velocity_y(const StateLayout &L) const
Definition GasState.hpp:465
MFEM_HOST_DEVICE mfem::real_t velocity_x(const StateLayout &L) const
Definition GasState.hpp:460
MFEM_HOST_DEVICE mfem::real_t pressure(const StateLayout &L) const
Definition GasState.hpp:475
MFEM_HOST_DEVICE void set_velocity(const StateLayout &L, int d, mfem::real_t val)
Definition GasState.hpp:454
MFEM_HOST_DEVICE void set_scalar(const StateLayout &L, int k, mfem::real_t val)
Definition GasState.hpp:494
MFEM_HOST_DEVICE int velocity_loc(const StateLayout &L) const
Definition GasState.hpp:441
MFEM_HOST_DEVICE mfem::real_t mass(const StateLayout &L) const
Definition GasState.hpp:428
MFEM_HOST_DEVICE mfem::real_t scalar(const StateLayout &L, int k) const
Definition GasState.hpp:486
MFEM_HOST_DEVICE void set_pressure(const StateLayout &L, mfem::real_t val)
Definition GasState.hpp:480
MFEM_HOST_DEVICE mfem::real_t velocity_z(const StateLayout &L) const
Definition GasState.hpp:470
mfem::real_t * U
Definition GasState.hpp:417
Definition GasState.hpp:339
MFEM_HOST_DEVICE mfem::real_t pressure(const StateLayout &L) const
Definition GasState.hpp:386
MFEM_HOST_DEVICE mfem::real_t velocity_x(const StateLayout &L) const
Definition GasState.hpp:371
MFEM_HOST_DEVICE mfem::real_t mass(const StateLayout &L) const
Definition GasState.hpp:353
const mfem::real_t * U
Definition GasState.hpp:340
MFEM_HOST_DEVICE mfem::real_t velocity_z(const StateLayout &L) const
Definition GasState.hpp:381
MFEM_HOST_DEVICE PointPrimitiveView(const mfem::real_t *U_)
Definition GasState.hpp:343
MFEM_HOST_DEVICE mfem::real_t velocity(const StateLayout &L, int d) const
Definition GasState.hpp:365
MFEM_HOST_DEVICE bool is_valid() const
Definition GasState.hpp:347
MFEM_HOST_DEVICE int velocity_loc(const StateLayout &L) const
Definition GasState.hpp:360
MFEM_HOST_DEVICE mfem::real_t scalar(const StateLayout &L, int k) const
Definition GasState.hpp:392
MFEM_HOST_DEVICE mfem::real_t velocity_y(const StateLayout &L) const
Definition GasState.hpp:376
Definition GasState.hpp:218
MFEM_HOST_DEVICE void set_mass(const StateLayout &L, mfem::real_t val)
Definition GasState.hpp:239
mfem::real_t * U
Definition GasState.hpp:219
MFEM_HOST_DEVICE mfem::real_t velocity_y(const StateLayout &L) const
Definition GasState.hpp:284
MFEM_HOST_DEVICE mfem::real_t velocity(const StateLayout &L, int d) const
Definition GasState.hpp:274
MFEM_HOST_DEVICE mfem::real_t energy(const StateLayout &L) const
Definition GasState.hpp:295
MFEM_HOST_DEVICE mfem::real_t mass(const StateLayout &L) const
Definition GasState.hpp:232
MFEM_HOST_DEVICE void set_momentum(const StateLayout &L, int d, mfem::real_t val)
Definition GasState.hpp:252
MFEM_HOST_DEVICE bool is_valid() const
Definition GasState.hpp:226
MFEM_HOST_DEVICE mfem::real_t scalar(const StateLayout &L, int k) const
Definition GasState.hpp:307
MFEM_HOST_DEVICE mfem::real_t momentum_z(const StateLayout &L) const
Definition GasState.hpp:268
MFEM_HOST_DEVICE mfem::real_t momentum_y(const StateLayout &L) const
Definition GasState.hpp:263
MFEM_HOST_DEVICE void set_energy(const StateLayout &L, mfem::real_t val)
Definition GasState.hpp:301
MFEM_HOST_DEVICE void set_scalar(const StateLayout &L, int k, mfem::real_t val)
Definition GasState.hpp:315
MFEM_HOST_DEVICE mfem::real_t velocity_x(const StateLayout &L) const
Definition GasState.hpp:279
MFEM_HOST_DEVICE mfem::real_t momentum_x(const StateLayout &L) const
Definition GasState.hpp:258
MFEM_HOST_DEVICE mfem::real_t momentum(const StateLayout &L, int d) const
Definition GasState.hpp:245
MFEM_HOST_DEVICE PointStateViewRW(mfem::real_t *U_)
Definition GasState.hpp:222
MFEM_HOST_DEVICE mfem::real_t velocity_z(const StateLayout &L) const
Definition GasState.hpp:289
Definition GasState.hpp:127
MFEM_HOST_DEVICE bool is_valid() const
Definition GasState.hpp:134
MFEM_HOST_DEVICE mfem::real_t energy(const StateLayout &L) const
Definition GasState.hpp:190
MFEM_HOST_DEVICE mfem::real_t momentum(const StateLayout &L, int d) const
Definition GasState.hpp:147
MFEM_HOST_DEVICE mfem::real_t velocity(const StateLayout &L, int d) const
Definition GasState.hpp:169
MFEM_HOST_DEVICE mfem::real_t momentum_y(const StateLayout &L) const
Definition GasState.hpp:158
MFEM_HOST_DEVICE PointStateView(const mfem::real_t *U_)
Definition GasState.hpp:130
MFEM_HOST_DEVICE mfem::real_t scalar(const StateLayout &L, int k) const
Definition GasState.hpp:196
MFEM_HOST_DEVICE mfem::real_t velocity_z(const StateLayout &L) const
Definition GasState.hpp:184
MFEM_HOST_DEVICE mfem::real_t velocity_x(const StateLayout &L) const
Definition GasState.hpp:174
const mfem::real_t * U
Definition GasState.hpp:128
MFEM_HOST_DEVICE mfem::real_t velocity_y(const StateLayout &L) const
Definition GasState.hpp:179
MFEM_HOST_DEVICE mfem::real_t mass(const StateLayout &L) const
Definition GasState.hpp:140
MFEM_HOST_DEVICE mfem::real_t momentum_x(const StateLayout &L) const
Definition GasState.hpp:153
MFEM_HOST_DEVICE mfem::real_t momentum_z(const StateLayout &L) const
Definition GasState.hpp:163
Definition GasState.hpp:37
int num_dofs_scalar
Definition GasState.hpp:39
MFEM_HOST_DEVICE int validate(int equation, int dof) const
Definition GasState.hpp:95
MFEM_HOST_DEVICE int nequations() const
Definition GasState.hpp:91
int eq_energy
Definition GasState.hpp:45
int eq_scalar0
Definition GasState.hpp:48
int eq_mom[3]
Definition GasState.hpp:44
int num_scalars
Definition GasState.hpp:49
int dim
Definition GasState.hpp:38
int eq_mom0
Definition GasState.hpp:43
MFEM_HOST_DEVICE int index(int equation, int dof) const
Definition GasState.hpp:102
MFEM_HOST_DEVICE StateLayout()=default
void setup(int dim_, int num_dofs_scalar_, int num_scalars_=0)
Definition GasState.hpp:69
int eq_mass
Definition GasState.hpp:42
StateLayout(int dim_, int num_dofs_scalar_, int num_scalars_=0)
Definition GasState.hpp:87