Skip to content

Commit b37743c

Browse files
committed
merge
2 parents 55008dc + de9c1e2 commit b37743c

File tree

6 files changed

+222
-31
lines changed

6 files changed

+222
-31
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
build/**
2-
.vscode/launch.json
2+
.vscode/launch.json

data/default_rules.json

Lines changed: 193 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
"boundary_conditions",
1717
"initial_conditions",
1818
"output",
19-
"input"
19+
"input",
20+
"authen_t1"
2021
],
2122
"doc": "Root of the configuration file."
2223
},
@@ -33,6 +34,56 @@
3334
"type": "string",
3435
"doc": "//TODO"
3536
},
37+
{
38+
"pointer": "/authen_t1",
39+
"default": null,
40+
"type": "object",
41+
"optional":[
42+
"err_h1",
43+
"err_h1_semi",
44+
"err_l2",
45+
"err_linf",
46+
"err_linf_grad",
47+
"err_lp",
48+
"margin"
49+
],
50+
"doc": "//TODO"
51+
},
52+
{
53+
"pointer": "/authen_t1/err_h1",
54+
"default":0,
55+
"type":"float"
56+
},
57+
{
58+
"pointer": "/authen_t1/err_h1_semi",
59+
"default":0,
60+
"type":"float"
61+
},
62+
{
63+
"pointer": "/authen_t1/err_l2",
64+
"default":0,
65+
"type":"float"
66+
},
67+
{
68+
"pointer": "/authen_t1/err_linf",
69+
"default":0,
70+
"type":"float"
71+
},
72+
{
73+
"pointer": "/authen_t1/err_linf_grad",
74+
"default":0,
75+
"type":"float"
76+
},
77+
{
78+
"pointer": "/authen_t1/err_lp",
79+
"default":0,
80+
"type":"float"
81+
},
82+
{
83+
"pointer": "/authen_t1/margin",
84+
"default":0,
85+
"type":"float"
86+
},
3687
{
3788
"pointer": "/geometry",
3889
"type": "list",
@@ -56,9 +107,15 @@
56107
"pointer": "/geometry/*/transformation",
57108
"type": "object",
58109
"default": null,
59-
"optional": ["translation","rotation","scale"],
110+
"optional": ["translation","rotation","rotation_mode","scale","dimensions"],
60111
"doc": "Geometric transformations applied to the geometry after loading it."
61112
},
113+
{
114+
"pointer": "/geometry/*/transformation/rotation_mode",
115+
"type": "string",
116+
"default": "xyz",
117+
"doc": "//TODO"
118+
},
62119
{
63120
"pointer": "/geometry/*/transformation/translation",
64121
"type": "list",
@@ -68,13 +125,24 @@
68125
{
69126
"pointer": "/geometry/*/transformation/rotation",
70127
"type": "list",
71-
"default": null,
72-
"doc": "Translation vector (2 entries for 2D problems, 3 entries for 3D problems)."
128+
"default": [],
129+
"doc": "Rotatation; in 2D, one number, the rotation angle, in 3D, three or four Euler angles, axis+angle, or a unit quaternion."
73130
},
74131
{
75132
"pointer": "/geometry/*/transformation/scale",
76133
"type": "list",
77-
"default": null
134+
"default": [],
135+
"doc": "Scaling along axes (2 entries for 2D problems, 3 entries for 3D problems)."
136+
},
137+
{
138+
"pointer": "/geometry/*/transformation/dimensions",
139+
"type": "list",
140+
"default": []
141+
},
142+
{
143+
"pointer": "/geometry/*/transformation/dimensions/*",
144+
"type": "float",
145+
"default": 0
78146
},
79147
{
80148
"pointer": "/geometry/*/transformation/translation/*",
@@ -84,8 +152,7 @@
84152
{
85153
"pointer": "/geometry/*/transformation/rotation/*",
86154
"default": 0,
87-
"type": "float",
88-
"doc": "Rotatation; in 2D, the rotation angle, in 3D, Euler angles, axis+angle, or quaternion "
155+
"type": "float"
89156
},
90157
{
91158
"pointer": "/geometry/*/transformation/scale/*",
@@ -105,12 +172,12 @@
105172
{
106173
"pointer": "/geometry/*/surface_selection",
107174
"type": "int",
108-
"default": null
175+
"default": 0
109176
},
110177
{
111178
"pointer": "/geometry/*/surface_selection",
112179
"type": "list"
113-
},
180+
},
114181
{
115182
"pointer": "/geometry/*/surface_selection",
116183
"type": "file",
@@ -120,7 +187,7 @@
120187
"pointer": "/geometry/*/surface_selection/*",
121188
"type": "object",
122189
"required":["id"],
123-
"optional":["axis", "position"],
190+
"optional":["axis", "position","box", "relative"],
124191
"default": null
125192
},
126193
{
@@ -137,6 +204,30 @@
137204
"type": "float",
138205
"default": null
139206
},
207+
{
208+
"pointer": "/geometry/*/surface_selection/*/relative",
209+
"type": "bool",
210+
"default": "//TODO"
211+
},
212+
{
213+
"pointer": "/geometry/*/surface_selection/*/box",
214+
"type": "list",
215+
"min":2,
216+
"max":2,
217+
"default": [[],[]]
218+
},
219+
{
220+
"pointer": "/geometry/*/surface_selection/*/box/*",
221+
"type": "list",
222+
"min":2,
223+
"max":3,
224+
"default": []
225+
},
226+
{
227+
"pointer": "/geometry/*/surface_selection/*/box/*/*",
228+
"type": "float",
229+
"default": 0
230+
},
140231
{
141232
"pointer": "/geometry/*/n_refs",
142233
"type": "int",
@@ -576,6 +667,11 @@
576667
"type": "string",
577668
"doc": "The coefficient of clamped log-barrier function"
578669
},
670+
{
671+
"pointer": "/solver/contact/barrier_stiffness",
672+
"type": "float",
673+
"doc": "The coefficient of clamped log-barrier function"
674+
},
579675
{
580676
"pointer": "/solver/contact/lagged_damping_weight",
581677
"default": 0,
@@ -619,7 +715,7 @@
619715
"pointer": "/materials/*",
620716
"type": "object",
621717
"required":["type"],
622-
"optional": ["id", "E", "nu", "rho", "mu", "lambda"],
718+
"optional": ["id", "E", "nu", "rho", "mu", "lambda","density"],
623719
"doc": "Material Parameters including id, Young's modulus(E), Poisson ratio(nu), Density(rho), type()"
624720
},
625721
{
@@ -646,6 +742,12 @@
646742
"default":"//TODO",
647743
"doc":"Density"
648744
},
745+
{
746+
"pointer": "/materials/*/density",
747+
"type":"float",
748+
"default":"//TODO",
749+
"doc":"Density"
750+
},
649751
{
650752
"pointer": "/materials/*/type",
651753
"type":"string",
@@ -766,8 +868,7 @@
766868
"default":"//TODO",
767869
"optional":[
768870
"id",
769-
"value",
770-
"dimension"
871+
"value"
771872
],
772873
"doc": "Neumann boundary condition"
773874
},
@@ -798,21 +899,9 @@
798899
{
799900
"pointer":"/boundary_conditions/neumann_boundary/*/value/*",
800901
"type":"float",
801-
"default":"//TODO",
902+
"default": "//TODO",
802903
"doc": "values of Neumann boundary condition for each dimension"
803904
},
804-
{
805-
"pointer":"/boundary_conditions/neumann_boundary/*/dimension",
806-
"type":"list",
807-
"default":[true, true, true],
808-
"doc": "If the dimension is under neumann boundary condition"
809-
},
810-
{
811-
"pointer":"/boundary_conditions/neumann_boundary/*/dimension/*",
812-
"type":"bool",
813-
"default":true,
814-
"doc": "If the dimension is under neumann boundary condition"
815-
},
816905
{
817906
"pointer": "/boundary_conditions/pressure_boundary",
818907
"default": [],
@@ -915,20 +1004,96 @@
9151004
},
9161005
{
9171006
"pointer": "/initial_conditions/solution",
918-
"default": null,
919-
"type": "object",
1007+
"default": [],
1008+
"type": "list",
1009+
"doc": "//TODO"
1010+
},
1011+
{
1012+
"pointer": "/initial_conditions/solution/*",
1013+
"default": 0,
1014+
"type": "float",
9201015
"doc": "//TODO"
9211016
},
9221017
{
9231018
"pointer": "/initial_conditions/velocity",
1019+
"default": [],
1020+
"type": "list",
1021+
"doc": "//TODO"
1022+
},
1023+
{
1024+
"pointer": "/initial_conditions/velocity/*",
9241025
"default": null,
9251026
"type": "object",
1027+
"required":["id","value"],
1028+
"doc": "//TODO"
1029+
},
1030+
{
1031+
"pointer": "/initial_conditions/velocity/*/id",
1032+
"type": "int",
1033+
"doc": "//TODO"
1034+
},
1035+
{
1036+
"pointer": "/initial_conditions/velocity/*/value",
1037+
"type": "list",
1038+
"min": 2,
1039+
"max":3,
1040+
"doc": "//TODO"
1041+
},
1042+
{
1043+
"pointer": "/initial_conditions/velocity/*/value",
1044+
"type": "float",
1045+
"doc": "//TODO"
1046+
},
1047+
{
1048+
"pointer": "/initial_conditions/velocity/*/value/*",
1049+
"type": "float",
1050+
"default":0,
1051+
"doc": "//TODO"
1052+
},
1053+
{
1054+
"pointer": "/initial_conditions/velocity/*/value/*",
1055+
"type": "string",
9261056
"doc": "//TODO"
9271057
},
9281058
{
9291059
"pointer": "/initial_conditions/acceleration",
1060+
"default": [],
1061+
"type": "list",
1062+
"doc": "//TODO"
1063+
},
1064+
{
1065+
"pointer": "/initial_conditions/acceleration/*",
9301066
"default": null,
9311067
"type": "object",
1068+
"required":["id","value"],
1069+
"doc": "//TODO"
1070+
},
1071+
{
1072+
"pointer": "/initial_conditions/acceleration/*/id",
1073+
"type": "int",
1074+
"doc": "//TODO"
1075+
},
1076+
{
1077+
"pointer": "/initial_conditions/acceleration/*/value",
1078+
"type": "list",
1079+
"min": 2,
1080+
"max":3,
1081+
"doc": "//TODO"
1082+
},
1083+
{
1084+
"pointer": "/initial_conditions/acceleration/*/value",
1085+
"type": "float",
1086+
"doc": "//TODO"
1087+
},
1088+
{
1089+
"pointer": "/initial_conditions/acceleration/*/value/*",
1090+
"type": "float",
1091+
"default":0,
1092+
"doc": "//TODO"
1093+
},
1094+
{
1095+
"pointer": "/initial_conditions/acceleration/*/value/*",
1096+
"type": "string",
9321097
"doc": "//TODO"
9331098
},
9341099
{

data/polyfem-data

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit 397d67ebab70fdf66c2303bf0777f2da07b186d8

src/sjv/sjv.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ namespace sjv
151151
std::string p_str = cwd + "/" + string(input);
152152
std::filesystem::path p = std::filesystem::path(p_str);
153153

154-
if (!std::filesystem::is_regular_file(p))
154+
if (!skip_file_check && !std::filesystem::is_regular_file(p))
155155
{
156156
log.push_back(log_item("warning", "File not found: " + p_str));
157157
if (strict)

src/sjv/sjv.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ namespace sjv
3939

4040
// if strict == false, a json is valid even if it has entries not validated by a rule
4141
bool strict = false;
42-
42+
bool skip_file_check = true;
4343
// automatic boxing for primitive types
4444
// if all rules fail for a basic type, try boxing it once and try again
4545
bool boxing_primitive = true;

tests/test_validator.cpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,4 +290,29 @@ TEST_CASE("slingshot", "[validator]")
290290
std:: string s = sjv.log2str();
291291
WARN(s);
292292
REQUIRE(r);
293+
}
294+
295+
TEST_CASE("polyfem-data", "[validator]"){
296+
std::ifstream ifs2("../data/default_rules.json");
297+
json rules = json::parse(ifs2);
298+
299+
std::string path("../data/polyfem-data/contact/examples");
300+
std::string ext(".json");
301+
for (auto &p : std::filesystem::recursive_directory_iterator(path))
302+
{
303+
if (p.path().extension() == ext){
304+
if(p.path().stem().string()=="common") continue;
305+
INFO(p.path().string());
306+
std::ifstream ifs1(p.path().string());
307+
json input = json::parse(ifs1);
308+
sjv::SJV sjv;
309+
310+
sjv.strict = true;
311+
312+
bool r = sjv.verify_json(input,rules);
313+
std:: string s = sjv.log2str();
314+
WARN(s);
315+
REQUIRE(r);
316+
}
317+
}
293318
}

0 commit comments

Comments
 (0)