query.h 1.92 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
// This file is a part of nla3d project. For information about authors and
// licensing go to project's repository on github:
// https://github.com/dmitryikh/nla3d 

#pragma once

namespace nla3d {

enum class scalarQuery {
  UNDEF = 0,
  SP,
  W,
  WU,
  WP,
  VOL,
  LAST
};

const char* const scalarQueryLabels[] = {"UNDEFINED", "S_P", "W", "WU", "WP", "VOL", "LAST"};

static_assert((int)scalarQuery::LAST == sizeof(scalarQueryLabels)/sizeof(scalarQueryLabels[0]) - 1,
    "scalarQuery enumeration and scalarQueryLabels must have the same number of entries");


enum class vectorQuery {
  UNDEF,
  IC,
  FLUX,
  LAST
};

const char* const vectorQueryLabels[] = {"UNDEFINEDS", "IC","FLUX","LAST"};

static_assert((int)vectorQuery::LAST == sizeof(vectorQueryLabels)/sizeof(vectorQueryLabels[0]) - 1,
    "vectorQuery enumeration and vectorQueryLabels must have the same number of entries");


enum class tensorQuery {
	UNDEF,
  // usual stress tensor
	COUCHY, 
  // second Piola-Kirchgoff stress tensor (symmetric 3x3)
  PK2, 
  // Lagrange deformations
  E,  
  // C = F^T F 
  C,  
  LAST
};

const char* const tensorQueryLabels[] = {"UNDEFINED","COUCHY", "PK2", "E", "C", "LAST"};

static_assert((int)tensorQuery::LAST == sizeof(tensorQueryLabels)/sizeof(tensorQueryLabels[0]) - 1,
    "tensorQuery enumeration and tensorQueryLabels must have the same number of entries");

// means averaged values of the element
const uint16 GP_MEAN = 100;

inline char const* query2label(scalarQuery query) {
  assert(query >= scalarQuery::UNDEF && query < scalarQuery::LAST);
  return scalarQueryLabels[(int) query];
}

inline char const* query2label(vectorQuery query) {
  assert(query >= vectorQuery::UNDEF && query < vectorQuery::LAST);
  return vectorQueryLabels[(int) query];
}

inline char const* query2label(tensorQuery query) {
  assert(query >= tensorQuery::UNDEF && query < tensorQuery::LAST);
  return tensorQueryLabels[(int) query];
}

} // namespace nla3d