| 1 |
// Copyright(C) 1999-2021 National Technology & Engineering Solutions |
| 2 |
// of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with |
| 3 |
// NTESS, the U.S. Government retains certain rights in this software. |
| 4 |
// |
| 5 |
// See packages/seacas/LICENSE for details |
| 6 |
|
| 7 |
#include "OperationsValidTests.h" |
| 8 |
#include "CatalystTestFixture.h" |
| 9 |
#include "catch.hpp" |
| 10 |
|
| 11 |
TEST_CASE_METHOD(CatalystTestFixture, "OperationBaseline", "[operationsValid]") |
| 12 |
{ |
| 13 |
Json::Value dj = getDefaultOperationsJSON(); |
| 14 |
checkPhactoriStringValidParse(OperationBaseline, dj); |
| 15 |
} |
| 16 |
|
| 17 |
TEST_CASE_METHOD(CatalystTestFixture, "OperationClip", "[operationsValid]") |
| 18 |
{ |
| 19 |
Json::Value dj = getDefaultOperationsJSON(); |
| 20 |
Json::Value fooOperation; |
| 21 |
fooOperation["type"] = "clip"; |
| 22 |
fooOperation["input"] = "clipNone"; |
| 23 |
dj["operation blocks"]["fooOperation"] = fooOperation; |
| 24 |
|
| 25 |
Json::Value &imageset = dj["imageset blocks"]["fooImageset"]; |
| 26 |
imageset["operation"] = "fooOperation"; |
| 27 |
checkPhactoriStringValidParse(OperationClip, dj); |
| 28 |
} |
| 29 |
|
| 30 |
TEST_CASE_METHOD(CatalystTestFixture, "OperationClipAbsolutePoint", "[operationsValid]") |
| 31 |
{ |
| 32 |
Json::Value dj = getDefaultOperationsJSON(); |
| 33 |
Json::Value fooOperation; |
| 34 |
fooOperation["type"] = "clip"; |
| 35 |
fooOperation["input"] = "clipNone"; |
| 36 |
Json::Value plane; |
| 37 |
plane[0] = 3.0; |
| 38 |
plane[1] = 0.1; |
| 39 |
plane[2] = 0.2; |
| 40 |
fooOperation["absolute point on plane"] = plane; |
| 41 |
Json::Value normal; |
| 42 |
normal[0] = 1.0; |
| 43 |
normal[1] = 1.0; |
| 44 |
normal[2] = 0.0; |
| 45 |
fooOperation["plane normal"] = normal; |
| 46 |
|
| 47 |
dj["operation blocks"]["fooOperation"] = fooOperation; |
| 48 |
|
| 49 |
Json::Value &imageset = dj["imageset blocks"]["fooImageset"]; |
| 50 |
imageset["operation"] = "fooOperation"; |
| 51 |
checkPhactoriStringValidParse(OperationClipAbsolutePoint, dj); |
| 52 |
} |
| 53 |
|
| 54 |
TEST_CASE_METHOD(CatalystTestFixture, "OperationClipRelativePoint", "[operationsValid]") |
| 55 |
{ |
| 56 |
Json::Value dj = getDefaultOperationsJSON(); |
| 57 |
Json::Value fooOperation; |
| 58 |
fooOperation["type"] = "clip"; |
| 59 |
fooOperation["input"] = "clipNone"; |
| 60 |
Json::Value plane; |
| 61 |
plane[0] = 0.25; |
| 62 |
plane[1] = 0.3; |
| 63 |
plane[2] = 0.5; |
| 64 |
fooOperation["relative point on plane"] = plane; |
| 65 |
Json::Value normal; |
| 66 |
normal[0] = 1.0; |
| 67 |
normal[1] = 1.0; |
| 68 |
normal[2] = 0.0; |
| 69 |
fooOperation["plane normal"] = normal; |
| 70 |
dj["operation blocks"]["fooOperation"] = fooOperation; |
| 71 |
|
| 72 |
Json::Value &camera = dj["camera blocks"]["singletestcamera"]; |
| 73 |
camera["look at absolute distance"] = 10.0; |
| 74 |
|
| 75 |
Json::Value &imageset = dj["imageset blocks"]["fooImageset"]; |
| 76 |
imageset["operation"] = "fooOperation"; |
| 77 |
checkPhactoriStringValidParse(OperationClipRelativePoint, dj); |
| 78 |
} |
| 79 |
|
| 80 |
TEST_CASE_METHOD(CatalystTestFixture, "OperationClipNode", "[operationsValid]") |
| 81 |
{ |
| 82 |
Json::Value dj = getDefaultOperationsJSON(); |
| 83 |
Json::Value fooOperation; |
| 84 |
fooOperation["type"] = "clip"; |
| 85 |
fooOperation["input"] = "clipNone"; |
| 86 |
fooOperation["node on plane"] = 20; |
| 87 |
Json::Value normal; |
| 88 |
normal[0] = 1.0; |
| 89 |
normal[1] = 1.0; |
| 90 |
normal[2] = 0.0; |
| 91 |
fooOperation["plane normal"] = normal; |
| 92 |
dj["operation blocks"]["fooOperation"] = fooOperation; |
| 93 |
|
| 94 |
Json::Value &imageset = dj["imageset blocks"]["fooImageset"]; |
| 95 |
imageset["operation"] = "fooOperation"; |
| 96 |
checkPhactoriStringValidParse(OperationClipNode, dj); |
| 97 |
} |
| 98 |
|
| 99 |
TEST_CASE_METHOD(CatalystTestFixture, "OperationClipElement", "[operationsValid]") |
| 100 |
{ |
| 101 |
Json::Value dj = getDefaultOperationsJSON(); |
| 102 |
Json::Value fooOperation; |
| 103 |
fooOperation["type"] = "clip"; |
| 104 |
fooOperation["input"] = "clipNone"; |
| 105 |
fooOperation["element on plane"] = 17; |
| 106 |
Json::Value normal; |
| 107 |
normal[0] = 1.0; |
| 108 |
normal[1] = 0.25; |
| 109 |
normal[2] = 0.0; |
| 110 |
fooOperation["plane normal"] = normal; |
| 111 |
dj["operation blocks"]["fooOperation"] = fooOperation; |
| 112 |
|
| 113 |
Json::Value &imageset = dj["imageset blocks"]["fooImageset"]; |
| 114 |
imageset["operation"] = "fooOperation"; |
| 115 |
checkPhactoriStringValidParse(OperationClipElement, dj); |
| 116 |
} |
| 117 |
|
| 118 |
TEST_CASE_METHOD(CatalystTestFixture, "OperationClipPlaneNormal", "[operationsValid]") |
| 119 |
{ |
| 120 |
Json::Value dj = getDefaultOperationsJSON(); |
| 121 |
Json::Value fooOperation; |
| 122 |
fooOperation["type"] = "clip"; |
| 123 |
fooOperation["input"] = "clipNone"; |
| 124 |
Json::Value normal; |
| 125 |
normal[0] = 1.0; |
| 126 |
normal[1] = 2.0; |
| 127 |
normal[2] = 3.0; |
| 128 |
fooOperation["plane normal"] = normal; |
| 129 |
Json::Value point; |
| 130 |
point[0] = 3.0; |
| 131 |
point[1] = 0.1; |
| 132 |
point[2] = 0.2; |
| 133 |
fooOperation["absolute point on plane"] = point; |
| 134 |
dj["operation blocks"]["fooOperation"] = fooOperation; |
| 135 |
|
| 136 |
Json::Value &imageset = dj["imageset blocks"]["fooImageset"]; |
| 137 |
imageset["operation"] = "fooOperation"; |
| 138 |
checkPhactoriStringValidParse(OperationClipPlaneNormal, dj); |
| 139 |
} |
| 140 |
|
| 141 |
TEST_CASE_METHOD(CatalystTestFixture, "OperationClipPlaneThreePoints1", "[operationsValid]") |
| 142 |
{ |
| 143 |
Json::Value dj = getDefaultOperationsJSON(); |
| 144 |
dj["operation blocks"].removeMember("clipNone"); |
| 145 |
Json::Value eb; |
| 146 |
eb["type"] = "extractblock"; |
| 147 |
Json::Value ib; |
| 148 |
ib[0] = "block_1"; |
| 149 |
eb["include blocks"] = ib; |
| 150 |
dj["operation blocks"]["eb1"] = eb; |
| 151 |
|
| 152 |
Json::Value fooOperation; |
| 153 |
fooOperation["type"] = "clip"; |
| 154 |
fooOperation["input"] = "eb1"; |
| 155 |
fooOperation["plane specification"] = "three points"; |
| 156 |
fooOperation["side to keep"] = "negative"; |
| 157 |
Json::Value planeA; |
| 158 |
planeA[0] = "max"; |
| 159 |
planeA[1] = "scalar"; |
| 160 |
planeA[2] = "VON_MISES"; |
| 161 |
planeA[3] = "eb1"; |
| 162 |
fooOperation["data point on plane A"] = planeA; |
| 163 |
Json::Value planeB; |
| 164 |
planeB[0] = "min"; |
| 165 |
planeB[1] = "scalar"; |
| 166 |
planeB[2] = "VON_MISES"; |
| 167 |
planeB[3] = "eb1"; |
| 168 |
fooOperation["data point on plane B"] = planeB; |
| 169 |
Json::Value planeC; |
| 170 |
planeC[0] = 0.0; |
| 171 |
planeC[1] = 10.0; |
| 172 |
planeC[2] = 0.0; |
| 173 |
fooOperation["relative point on plane C"] = planeC; |
| 174 |
dj["operation blocks"]["fooOperation"] = fooOperation; |
| 175 |
|
| 176 |
Json::Value clipop2; |
| 177 |
clipop2["type"] = "clip"; |
| 178 |
clipop2["plane specification"] = "three points"; |
| 179 |
Json::Value planeA2; |
| 180 |
planeA2[0] = "max"; |
| 181 |
planeA2[1] = "scalar"; |
| 182 |
planeA2[2] = "VON_MISES"; |
| 183 |
planeA2[3] = "eb1"; |
| 184 |
clipop2["data point on plane A"] = planeA2; |
| 185 |
Json::Value planeB2; |
| 186 |
planeB2[0] = 0.0; |
| 187 |
planeB2[1] = 0.0; |
| 188 |
planeB2[2] = 10.0; |
| 189 |
clipop2["relative point on plane B"] = planeB2; |
| 190 |
Json::Value planeC2; |
| 191 |
planeC2[0] = 0.0; |
| 192 |
planeC2[1] = 10.0; |
| 193 |
planeC2[2] = 0.0; |
| 194 |
clipop2["relative point on plane C"] = planeC2; |
| 195 |
dj["operation blocks"]["clipop2"] = clipop2; |
| 196 |
|
| 197 |
Json::Value &camera = dj["camera blocks"]["singletestcamera"]; |
| 198 |
camera.removeMember("look direction"); |
| 199 |
Json::Value point1; |
| 200 |
point1[0] = 15.0; |
| 201 |
point1[1] = 10.0; |
| 202 |
point1[2] = 10.0; |
| 203 |
camera["camera at absolute point"] = point1; |
| 204 |
Json::Value point2; |
| 205 |
point2[0] = 5.0; |
| 206 |
point2[1] = 0.0; |
| 207 |
point2[2] = 0.0; |
| 208 |
camera["look at absolute point"] = point2; |
| 209 |
|
| 210 |
Json::Value &imageset = dj["imageset blocks"]["fooImageset"]; |
| 211 |
Json::Value is2(imageset); |
| 212 |
Json::Value is3(imageset); |
| 213 |
imageset["operation"] = "fooOperation"; |
| 214 |
imageset["color by scalar"] = "VON_MISES"; |
| 215 |
imageset["show edges"] = true; |
| 216 |
is2["operation"] = "clipop2"; |
| 217 |
is2["show edges"] = true; |
| 218 |
is2["color by scalar"] = "VON_MISES"; |
| 219 |
is3["show edges"] = true; |
| 220 |
is3["color by scalar"] = "VON_MISES"; |
| 221 |
is3.removeMember("operation"); |
| 222 |
|
| 223 |
dj["imageset blocks"]["is2"] = is2; |
| 224 |
dj["imageset blocks"]["is3"] = is3; |
| 225 |
|
| 226 |
checkPhactoriStringValidParse(OperationClipPlaneThreePoints1, dj); |
| 227 |
} |