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
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
//! This modules holds the the global static node [`Card`](::card::Card)
//! instances.
use card::{
  cell::Cell::*,
  ges::GesType::*,
  keyword::Keyword::*,
  line::{Conditional::*, Line::*},
  Card,
};

pub static NODE: Card = Card {
  lines: &[Cells(&[Kw, Integer(16), Float(16), Float(16), Float(16)])],
  ownfold: false,
  keyword: Node,
};

pub static CNODE: Card = Card {
  lines: &[Cells(&[Kw, Integer(16), Float(16), Float(16), Float(16)])],
  ownfold: false,
  keyword: Cnode,
};

pub static MASS: Card = Card {
  lines: &[
    Cells(&[Kw, Integer(8), Integer(8), Float(16), Float(16), Float(16)]),
    Cells(&[Fixed("NAME"), Str(76)]),
    Cells(&[Float(16), Float(16), Float(16)]),
    Provides(
      &[Blank(8), Float(16), Float(16), Float(16), Blank(24), Cont],
      RelChar(80, b'&'),
    ),
    Optional(&[Blank(8), Float(16), Float(16), Float(16)], 0),
    Ges(GesNode),
  ],
  ownfold: true,
  keyword: Mass,
};

pub static NSMAS: Card = Card {
  lines: &[
    Cells(&[Kw, Integer(8), Float(16), Float(16), Float(16), Float(16)]),
    Cells(&[Fixed("NAME"), Str(76)]),
    Ges(GesEle),
  ],
  ownfold: true,
  keyword: Nsmas,
};

pub static NSMAS2: Card = Card {
  lines: &[
    Cells(&[Kw, Integer(8), Float(16), Float(16), Float(16), Float(16)]),
    Cells(&[Fixed("NAME"), Str(76)]),
    Ges(GesEle),
  ],
  ownfold: true,
  keyword: Nsmas2,
};

#[cfg(test)]
mod tests {
  use card::keyword::Keyword::*;

  const CARD_NSMAS: [&'static str; 7] = [
    "NSMAS /        1              0.                                                ",
    "$#                                                                         TITLE",
    "NAME NSMAS / ->1                                                                ",
    "        ELE 123",
    "        PART 2345",
    "        END",
    "#Comment",
  ];

  cardtest!(fold_nsmas, CARD_NSMAS, vec![(0, 5, Nsmas)]);

  const CARD_NSMAS2: [&'static str; 7] = [
    "$ NSMAS - Nonstructural mass",
    "$#       IDNODMS            MASS            MLEN            MARE            MVOL",
    "NSMAS /        1              0.                                                ",
    "$#                                                                         TITLE",
    "NAME NSMAS / ->1                                                                ",
    "        ELE ",
    "        END",
  ];

  cardtest!(fold_nsmas2, CARD_NSMAS2, vec![(2, 6, Nsmas)]);

  const CARD_MASS: [&'static str; 10] = [
    "$ MASS Card",
    "$#         IDNOD    IFRA   Blank            DISr            DISs            DISt",
    "MASS  /        0       0                                                        ",
    "$#                                                                         TITLE",
    "NAME MASS  / ->1                                                                ",
    "$# BLANK              Mx              My              Mz",
    "                                                        ",
    "$# BLANK              Ix              Iy              Iz                   Blank",
    "                                                                                ",
    "        END",
  ];

  cardtest!(fold_mass, CARD_MASS, vec![(2, 9, Mass)]);

  const CARD_MASS_OPT: [&'static str; 12] = [
    "MASS  /        0       0                                                        ",
    "$#                                                                         TITLE",
    "NAME MASS  / ->1                                                                ",
    "$# BLANK              Mx              My              Mz",
    "                                                        ",
    "$# BLANK              Ix              Iy              Iz                   Blank",
    "                                                                                &",
    "                                                  ",
    "        PART 1234",
    "        GRP 'nogrp'",
    "        END",
    "$Comment",
  ];

  cardtest!(fold_mass_opt, CARD_MASS_OPT, vec![(0, 10, Mass)]);

  const CARD_NODES: [&'static str; 9] = [
    "NODE  /       28     30.29999924            50.5              0.",
    "NODE  /       28     30.29999924            50.5              0.",
    "NODE  /       28     30.29999924            50.5              0.",
    "#COMMENT",
    "NODE  /       28     30.29999924            50.5              0.",
    "$COMMENT",
    "NODE  /       28     30.29999924            50.5              0.",
    "NODE  /       28     30.29999924            50.5              0.",
    "SHELL /     ",
  ];

  cardtest!(fold_nodes, CARD_NODES, vec![(0, 7, Node), (8, 8, Shell)]);

}