File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -1179,12 +1179,23 @@ void Mesh::Read(const std::string & strFile) {
11791179 int nElementBlocks = dimElementBlocks->size ();
11801180
11811181 // Total number of elements
1182+ int nTotalElementCount = 0 ;
11821183 NcDim * dimElements = ncFile.get_dim (" num_elem" );
11831184 if (dimElements == NULL ) {
1184- _EXCEPTION1 (" Exodus Grid file \" %s\" is missing dimension "
1185+ for (unsigned ib = 1 ; ib <= nElementBlocks; ++ib)
1186+ {
1187+ std::string numelblk = std::string (" num_el_in_blk" +std::to_string (ib));
1188+ NcDim * dimElementBlockElems = ncFile.get_dim (numelblk.c_str ());
1189+ nTotalElementCount += (dimElementBlockElems != NULL ? dimElementBlockElems->size () : 0 );
1190+ }
1191+ if (nTotalElementCount == 0 )
1192+ _EXCEPTION1 (" Exodus Grid file \" %s\" is missing dimension "
11851193 " \" num_elem\" " , strFile.c_str ());
11861194 }
1187- int nTotalElementCount = dimElements->size ();
1195+ else
1196+ {
1197+ nTotalElementCount = dimElements->size ();
1198+ }
11881199
11891200 // Output size
11901201 Announce (" Mesh size: Nodes [%i] Elements [%i]" ,
You can’t perform that action at this time.
0 commit comments