$extrastylesheet
00001 // The libMesh Finite Element Library. 00002 // Copyright (C) 2002-2014 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner 00003 00004 // This library is free software; you can redistribute it and/or 00005 // modify it under the terms of the GNU Lesser General Public 00006 // License as published by the Free Software Foundation; either 00007 // version 2.1 of the License, or (at your option) any later version. 00008 00009 // This library is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 // Lesser General Public License for more details. 00013 00014 // You should have received a copy of the GNU Lesser General Public 00015 // License along with this library; if not, write to the Free Software 00016 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00017 00018 00019 00020 // C++ includes 00021 #include <cstdio> // for std::sprintf 00022 #include <fstream> 00023 00024 // Local includes 00025 #include "libmesh/libmesh_config.h" 00026 #include "libmesh/mesh_data.h" 00027 #include "libmesh/auto_ptr.h" 00028 00029 #ifdef LIBMESH_HAVE_GZSTREAM 00030 # include "gzstream.h" // For reading/writing compressed streams 00031 #endif 00032 00033 00034 namespace libMesh 00035 { 00036 00037 //------------------------------------------------------ 00038 // MeshData UNV support functions 00039 void MeshData::read_unv (const std::string& file_name) 00040 { 00041 /* 00042 * we should better be active or in compatibility mode 00043 */ 00044 libmesh_assert (this->_active || this->_compatibility_mode); 00045 00046 /* 00047 * When reading data, make sure the id maps are ok 00048 */ 00049 libmesh_assert (this->_node_id_map_closed); 00050 libmesh_assert (this->_elem_id_map_closed); 00051 00052 /* 00053 * clear the data, but keep the id maps 00054 */ 00055 this->clear(); 00056 00057 /* 00058 * We can read either ".unv", or ".unv.gz" 00059 * files, provided zlib.h is there 00060 */ 00061 if (file_name.rfind(".gz") < file_name.size()) 00062 { 00063 #ifdef LIBMESH_HAVE_GZSTREAM 00064 igzstream in_stream(file_name.c_str()); 00065 this->read_unv_implementation (in_stream); 00066 #else 00067 libmesh_error_msg("ERROR: You must have the zlib.h header files and libraries to read and write compressed streams."); 00068 #endif 00069 return; 00070 } 00071 00072 else 00073 { 00074 std::ifstream in_stream(file_name.c_str()); 00075 this->read_unv_implementation (in_stream); 00076 return; 00077 } 00078 } 00079 00080 00081 00082 00083 00084 00085 void MeshData::read_unv_implementation (std::istream& in_file) 00086 { 00087 /* 00088 * This is the actual implementation of 00089 * reading in UNV format. This enables 00090 * to read either through the conventional 00091 * C++ stream, or through a stream that 00092 * allows to read .gz'ed files. 00093 */ 00094 if ( !in_file.good() ) 00095 libmesh_error_msg("ERROR: Input file not good."); 00096 00097 const std::string _label_dataset_mesh_data = "2414"; 00098 00099 /* 00100 * locate the beginning of data set 00101 * and read it. 00102 */ 00103 { 00104 std::string olds, news; 00105 00106 while (true) 00107 { 00108 in_file >> olds >> news; 00109 00110 /* 00111 * Yes, really dirty: 00112 * 00113 * When we found a dataset, and the user does 00114 * not want this dataset, we jump back here 00115 */ 00116 go_and_find_the_next_dataset: 00117 00118 /* 00119 * a "-1" followed by a number means the beginning of a dataset 00120 * stop combing at the end of the file 00121 */ 00122 while( ((olds != "-1") || (news == "-1") ) && !in_file.eof() ) 00123 { 00124 olds = news; 00125 in_file >> news; 00126 } 00127 00128 if(in_file.eof()) 00129 break; 00130 00131 /* 00132 * if beginning of dataset 00133 */ 00134 if (news == _label_dataset_mesh_data) 00135 { 00136 00137 /* 00138 * Now read the data of interest. 00139 * Start with the header. For 00140 * explanation of the variable 00141 * dataset_location, see below. 00142 */ 00143 unsigned int dataset_location; 00144 00145 /* 00146 * the type of data (complex, real, 00147 * float, double etc, see below) 00148 */ 00149 unsigned int data_type; 00150 00151 /* 00152 * the number of floating-point values per entity 00153 */ 00154 unsigned int NVALDC; 00155 00156 00157 /* 00158 * If there is no MeshDataUnvHeader object 00159 * attached 00160 */ 00161 if (_unv_header==NULL) 00162 { 00163 /* 00164 * Ignore the first lines that stand for 00165 * analysis dataset label and name. 00166 */ 00167 for(unsigned int i=0; i<3; i++) 00168 in_file.ignore(256,'\n'); 00169 00170 /* 00171 * Read the dataset location, where 00172 * 1: Data at nodes 00173 * 2: Data on elements 00174 * other sets are currently not supported. 00175 */ 00176 in_file >> dataset_location; 00177 00178 /* 00179 * Ignore five ID lines. 00180 */ 00181 for(unsigned int i=0; i<6; i++) 00182 in_file.ignore(256,'\n'); 00183 00184 /* 00185 * These data are all of no interest to us... 00186 */ 00187 unsigned int model_type, 00188 analysis_type, 00189 data_characteristic, 00190 result_type; 00191 00192 /* 00193 * Read record 9. 00194 */ 00195 in_file >> model_type // not used here 00196 >> analysis_type // not used here 00197 >> data_characteristic // not used here 00198 >> result_type // not used here 00199 >> data_type 00200 >> NVALDC; 00201 00202 00203 /* 00204 * Ignore record 10 and 11 00205 * (Integer analysis type specific data). 00206 */ 00207 for (unsigned int i=0; i<3; i++) 00208 in_file.ignore(256,'\n'); 00209 00210 /* 00211 * Ignore record 12 and record 13. Since there 00212 * exist UNV files with 'D' instead of 'e' as 00213 * 10th-power char, it is safer to use a string 00214 * to read the dummy reals. 00215 */ 00216 { 00217 std::string dummy_Real; 00218 for (unsigned int i=0; i<12; i++) 00219 in_file >> dummy_Real; 00220 } 00221 00222 } 00223 else 00224 { 00225 00226 /* 00227 * the read() method returns false when 00228 * the user wanted a special header, and 00229 * when the current header is _not_ the correct 00230 * header 00231 */ 00232 if (_unv_header->read(in_file)) 00233 { 00234 dataset_location = _unv_header->dataset_location; 00235 NVALDC = _unv_header->nvaldc; 00236 data_type = _unv_header->data_type; 00237 } 00238 else 00239 { 00240 /* 00241 * This is not the correct header. Go 00242 * and find the next. For this to 00243 * work correctly, shift to the 00244 * next line, so that the "-1" 00245 * disappears from olds 00246 */ 00247 olds = news; 00248 in_file >> news; 00249 00250 /* 00251 * No good style, i know... 00252 */ 00253 goto go_and_find_the_next_dataset; 00254 } 00255 00256 } 00257 00258 /* 00259 * Check the location of the dataset. 00260 */ 00261 if (dataset_location != 1) 00262 libmesh_error_msg("ERROR: Currently only Data at nodes is supported."); 00263 00264 00265 /* 00266 * Now get the foreign node id number and the respective nodal data. 00267 */ 00268 int f_n_id; 00269 std::vector<Number> values; 00270 00271 while(true) 00272 { 00273 in_file >> f_n_id; 00274 00275 /* 00276 * if node_nr = -1 then we have reached the end of the dataset. 00277 */ 00278 if (f_n_id==-1) 00279 break; 00280 00281 /* 00282 * Resize the values vector (usually data in three 00283 * principle directions, i.e. NVALDC = 3). 00284 */ 00285 values.resize(NVALDC); 00286 00287 /* 00288 * Read the meshdata for the respective node. 00289 */ 00290 for (unsigned int data_cnt=0; data_cnt<NVALDC; data_cnt++) 00291 { 00292 /* 00293 * Check what data type we are reading. 00294 * 2,4: Real 00295 * 5,6: Complex 00296 * other data types are not supported yet. 00297 * As again, these floats may also be written 00298 * using a 'D' instead of an 'e'. 00299 */ 00300 if (data_type == 2 || data_type == 4) 00301 { 00302 std::string buf; 00303 in_file >> buf; 00304 MeshDataUnvHeader::need_D_to_e(buf); 00305 #ifdef LIBMESH_USE_COMPLEX_NUMBERS 00306 values[data_cnt] = Complex(std::atof(buf.c_str()), 0.); 00307 #else 00308 values[data_cnt] = std::atof(buf.c_str()); 00309 #endif 00310 } 00311 00312 else if(data_type == 5 || data_type == 6) 00313 00314 { 00315 #ifdef LIBMESH_USE_COMPLEX_NUMBERS 00316 Real re_val, im_val; 00317 00318 std::string buf; 00319 in_file >> buf; 00320 00321 if (MeshDataUnvHeader::need_D_to_e(buf)) 00322 { 00323 re_val = std::atof(buf.c_str()); 00324 in_file >> buf; 00325 MeshDataUnvHeader::need_D_to_e(buf); 00326 im_val = std::atof(buf.c_str()); 00327 } 00328 else 00329 { 00330 re_val = std::atof(buf.c_str()); 00331 in_file >> im_val; 00332 } 00333 00334 values[data_cnt] = Complex(re_val,im_val); 00335 #else 00336 00337 libmesh_error_msg("ERROR: Complex data only supported when libMesh is configured with --enable-complex!"); 00338 #endif 00339 } 00340 00341 else 00342 libmesh_error_msg("ERROR: Data type not supported."); 00343 00344 } // end loop data_cnt 00345 00346 /* 00347 * Add the values vector to the MeshData data structure. 00348 */ 00349 const Node* node = foreign_id_to_node(f_n_id); 00350 _node_data.insert (std::make_pair(node, values)); 00351 00352 } // while(true) 00353 } 00354 00355 00356 else 00357 { 00358 /* 00359 * all other datasets are ignored 00360 */ 00361 } 00362 00363 } 00364 } 00365 00366 00367 /* 00368 * finished reading. Ready for use, provided 00369 * there was any data contained in the file. 00370 */ 00371 libmesh_assert ((this->_node_data.size() != 0) || (this->_elem_data.size() != 0)); 00372 00373 this->_node_data_closed = true; 00374 this->_elem_data_closed = true; 00375 } 00376 00377 00378 00379 00380 00381 00382 void MeshData::write_unv (const std::string& file_name) 00383 { 00384 /* 00385 * we should better be active or in compatibility mode 00386 */ 00387 libmesh_assert (this->_active || this->_compatibility_mode); 00388 00389 /* 00390 * make sure the id maps are ready 00391 * and that we have data to write 00392 */ 00393 libmesh_assert (this->_node_id_map_closed); 00394 libmesh_assert (this->_elem_id_map_closed); 00395 00396 libmesh_assert (this->_node_data_closed); 00397 libmesh_assert (this->_elem_data_closed); 00398 00399 if (file_name.rfind(".gz") < file_name.size()) 00400 { 00401 #ifdef LIBMESH_HAVE_GZSTREAM 00402 ogzstream out_stream(file_name.c_str()); 00403 this->write_unv_implementation (out_stream); 00404 #else 00405 libmesh_error_msg("ERROR: You must have the zlib.h header files and libraries to read and write compressed streams."); 00406 #endif 00407 return; 00408 00409 } 00410 00411 else 00412 { 00413 std::ofstream out_stream(file_name.c_str()); 00414 this->write_unv_implementation (out_stream); 00415 return; 00416 } 00417 } 00418 00419 00420 00421 00422 00423 00424 void MeshData::write_unv_implementation (std::ostream& out_file) 00425 { 00426 /* 00427 * This is the actual implementation of writing 00428 * unv files, either as .unv or as .unv.gz file 00429 */ 00430 if ( !out_file.good() ) 00431 libmesh_error_msg("ERROR: Output file not good."); 00432 00433 00434 /* 00435 * the beginning marker of the dataset block for 00436 * nodal/element-associated data (not to be confused 00437 * with _desired_dataset_label!) 00438 */ 00439 const std::string _label_dataset_mesh_data = "2414"; 00440 00441 /* 00442 * Currently this function handles only nodal data. 00443 */ 00444 libmesh_assert (!_node_data.empty()); 00445 00446 if (!_elem_data.empty()) 00447 libMesh::err << "WARNING: MeshData currently only supports nodal data for Universal files." 00448 << std::endl 00449 << " Will proceed writing only nodal data, ignoring element data." 00450 << std::endl; 00451 00452 00453 /* 00454 * Write the beginning of the dataset. 00455 */ 00456 out_file << " -1\n" 00457 << " " 00458 << _label_dataset_mesh_data 00459 << "\n"; 00460 00461 /* 00462 * Write the header 00463 */ 00464 if (_unv_header==NULL) 00465 { 00466 /* 00467 * create a header that holds at 00468 * least sufficient data to specify 00469 * what this data set currently holds. 00470 * 00471 * The empty constructor automatically 00472 * takes care of \p dataset_location 00473 * and \p data_type. 00474 */ 00475 MeshDataUnvHeader my_header; 00476 00477 /* 00478 * It remains to set the correct nvaldc... 00479 */ 00480 my_header.nvaldc = this->n_val_per_node(); 00481 00482 /* 00483 * and the correct data type. By default 00484 * only distinguish complex or real data. 00485 */ 00486 #ifdef LIBMESH_USE_COMPLEX_NUMBERS 00487 my_header.data_type = 5; 00488 #else 00489 my_header.data_type = 2; 00490 #endif 00491 00492 /* 00493 * write this default header, then let 00494 * the UniquePtr go out of scope. This 00495 * will take care of memory management. 00496 */ 00497 my_header.write (out_file); 00498 } 00499 00500 else 00501 { 00502 /* 00503 * make sure our nvaldc coincide. 00504 */ 00505 if (this->n_val_per_node() != _unv_header->nvaldc) 00506 { 00507 libMesh::err << "WARNING: nvaldc=" << _unv_header->nvaldc 00508 << " of attached MeshDataUnvHeader object not valid!" << std::endl 00509 << " re-set nvaldc to " << this->n_val_per_node() << std::endl; 00510 _unv_header->nvaldc = this->n_val_per_node(); 00511 } 00512 00513 00514 /* 00515 * only issue a warning when data_type does 00516 * not coincide. Perhaps user provided some 00517 * other header in order to convert complex 00518 * to real... 00519 */ 00520 #ifdef LIBMESH_USE_COMPLEX_NUMBERS 00521 const unsigned int my_data_type = 5; 00522 #else 00523 const unsigned int my_data_type = 2; 00524 #endif 00525 if (my_data_type != _unv_header->data_type) 00526 { 00527 libMesh::err << "WARNING: data_type=" << _unv_header->data_type 00528 << " of attached MeshDataUnvHeader differs from" << std::endl 00529 << " default value=" << my_data_type 00530 << " Perhaps the user wanted this," << std::endl 00531 << " so I use the value from the MeshDataUnvHeader." 00532 << std::endl; 00533 } 00534 _unv_header->write (out_file); 00535 } 00536 00537 00538 /* 00539 * Write the foreign node number and the respective data. 00540 */ 00541 std::map<const Node*, 00542 std::vector<Number> >::const_iterator nit = _node_data.begin(); 00543 00544 char buf[27]; 00545 for (; nit != _node_data.end(); ++nit) 00546 { 00547 const Node* node = (*nit).first; 00548 00549 unsigned int f_n_id = node_to_foreign_id (node); 00550 std::sprintf(buf, "%10u\n", f_n_id); 00551 out_file << buf; 00552 00553 /* since we are iterating over our own map, this libmesh_assert 00554 * should never break... 00555 */ 00556 libmesh_assert (this->has_data(node)); 00557 00558 // const reference to the nodal values 00559 const std::vector<Number>& values = this->get_data(node); 00560 00561 for (unsigned int v_cnt=0; v_cnt<values.size(); v_cnt++) 00562 { 00563 #ifdef LIBMESH_USE_COMPLEX_NUMBERS 00564 std::sprintf(buf, "%13.5E%13.5E", values[v_cnt].real(), 00565 values[v_cnt].imag()); 00566 out_file << buf; 00567 #else 00568 std::sprintf(buf, "%13.5E", 00569 static_cast<double>(values[v_cnt])); 00570 out_file << buf; 00571 #endif 00572 } 00573 00574 out_file << "\n"; 00575 00576 00577 } 00578 00579 /* 00580 * Write end of the dataset. 00581 */ 00582 out_file << " -1\n"; 00583 } 00584 00585 00586 00587 00588 00589 //------------------------------------------------------ 00590 // MeshDataUnvHeader functions 00591 MeshDataUnvHeader::MeshDataUnvHeader() : 00592 dataset_label (0), 00593 dataset_name ("libMesh mesh data"), 00594 dataset_location (1), // default to nodal data 00595 model_type (0), 00596 analysis_type (0), 00597 data_characteristic (0), 00598 result_type (0), 00599 #ifdef LIBMESH_USE_COMPLEX_NUMBERS 00600 data_type (5), // default to single precision complex 00601 #else 00602 data_type (2), // default to single precision real 00603 #endif 00604 nvaldc (3), // default to 3 (principle directions) 00605 _desired_dataset_label (libMesh::invalid_uint) 00606 { 00607 id_lines_1_to_5.resize(5); 00608 std::fill (id_lines_1_to_5.begin(), id_lines_1_to_5.end(), std::string("libMesh default")); 00609 /* 00610 * resize analysis specific data. 00611 */ 00612 record_10.resize(8); 00613 record_11.resize(2); 00614 record_12.resize(6); 00615 record_13.resize(6); 00616 } 00617 00618 00619 00620 00621 00622 MeshDataUnvHeader::~MeshDataUnvHeader() 00623 { 00624 // empty 00625 } 00626 00627 00628 00629 00630 bool MeshDataUnvHeader::read (std::istream& in_file) 00631 { 00632 in_file >> this->dataset_label; 00633 00634 /* 00635 * currently, we compare only the 00636 * dataset_label with the _desired_dataset_label, 00637 * but it may be easy to also compare the 00638 * dataset_name. 00639 * 00640 * When the user provided a dataset label, and 00641 * the current label does _not_ match, then just 00642 * return false. 00643 * 00644 * Otherwise: when the current label matches, 00645 * or when there is no desired dataset label, 00646 * simply proceed. 00647 */ 00648 if ((this->_desired_dataset_label != libMesh::invalid_uint) && 00649 (this->dataset_label != this->_desired_dataset_label)) 00650 return false; 00651 00652 00653 in_file.ignore(256,'\n'); 00654 std::getline(in_file, dataset_name, '\n'); 00655 00656 in_file >> this->dataset_location; 00657 in_file.ignore(256,'\n'); 00658 00659 00660 for (unsigned int n=0; n<5; n++) 00661 std::getline(in_file, this->id_lines_1_to_5[n], '\n'); 00662 00663 00664 in_file >> this->model_type 00665 >> this->analysis_type 00666 >> this->data_characteristic 00667 >> this->result_type 00668 >> this->data_type 00669 >> this->nvaldc; 00670 00671 for (unsigned int i=0; i<8; i++) 00672 in_file >> this->record_10[i]; 00673 00674 for (unsigned int i=0; i<2; i++) 00675 in_file >> this->record_11[i]; 00676 00677 00678 /* 00679 * There are UNV-files where floats are 00680 * written with 'D' as the 10th-power 00681 * character. Replace this 'D' by 'e', 00682 * so that std::atof() can work fine. 00683 */ 00684 std::string buf; 00685 in_file >> buf; 00686 00687 if (need_D_to_e(buf)) 00688 { 00689 // have to convert _all_ 'D' to 'e' 00690 this->record_12[0] = std::atof(buf.c_str()); 00691 00692 for (unsigned int i=1; i<6; i++) 00693 { 00694 in_file >> buf; 00695 need_D_to_e(buf); 00696 this->record_12[i] = std::atof(buf.c_str()); 00697 } 00698 00699 for (unsigned int i=0; i<6; i++) 00700 { 00701 in_file >> buf; 00702 need_D_to_e(buf); 00703 this->record_13[i] = std::atof(buf.c_str()); 00704 } 00705 } 00706 else 00707 { 00708 // no 'D', the stream will recognize the floats 00709 this->record_12[0] = std::atof(buf.c_str()); 00710 00711 for (unsigned int i=1; i<6; i++) 00712 in_file >> this->record_12[i]; 00713 00714 for (unsigned int i=0; i<6; i++) 00715 in_file >> this->record_13[i]; 00716 } 00717 00718 /* 00719 * no matter whether the user provided a desired 00720 * dataset label or not: return true, b/c the 00721 * non-match was already caught before. 00722 */ 00723 return true; 00724 } 00725 00726 00727 00728 00729 void MeshDataUnvHeader::write (std::ostream& out_file) 00730 { 00731 00732 00733 char buf[82]; 00734 00735 std::sprintf(buf, "%6i\n",this->dataset_label); 00736 00737 out_file << buf; 00738 00739 out_file << this->dataset_name << "\n"; 00740 00741 std::sprintf(buf, "%6i\n",this->dataset_location); 00742 00743 out_file << buf; 00744 00745 for (unsigned int n=0; n<5; n++) 00746 out_file << this->id_lines_1_to_5[n] << "\n"; 00747 00748 std::sprintf(buf, "%10i%10i%10i%10i%10i%10i\n", 00749 model_type, analysis_type, data_characteristic, 00750 result_type, data_type, nvaldc); 00751 00752 out_file << buf; 00753 00754 std::sprintf(buf, "%10i%10i%10i%10i%10i%10i%10i%10i\n", 00755 record_10[0], record_10[1], record_10[2], record_10[3], 00756 record_10[4], record_10[5], record_10[6], record_10[7]); 00757 00758 out_file << buf; 00759 00760 std::sprintf(buf, "%10i%10i\n", record_11[0], record_11[1]); 00761 out_file << buf; 00762 00763 std::sprintf(buf, "%13.5E%13.5E%13.5E%13.5E%13.5E%13.5E\n", 00764 static_cast<double>(record_12[0]), 00765 static_cast<double>(record_12[1]), 00766 static_cast<double>(record_12[2]), 00767 static_cast<double>(record_12[3]), 00768 static_cast<double>(record_12[4]), 00769 static_cast<double>(record_12[5])); 00770 00771 out_file << buf; 00772 00773 std::sprintf(buf, "%13.5E%13.5E%13.5E%13.5E%13.5E%13.5E\n", 00774 static_cast<double>(record_13[0]), 00775 static_cast<double>(record_13[1]), 00776 static_cast<double>(record_13[2]), 00777 static_cast<double>(record_13[3]), 00778 static_cast<double>(record_13[4]), 00779 static_cast<double>(record_13[5])); 00780 00781 out_file << buf; 00782 } 00783 00784 00785 00786 00787 00788 bool MeshDataUnvHeader::need_D_to_e (std::string& number) 00789 { 00790 // find "D" in string, start looking at 6th element, to improve speed. 00791 // We dont expect a "D" earlier 00792 std::string::size_type position = number.find("D",6); 00793 00794 if(position!=std::string::npos) // npos means no position 00795 { 00796 // replace "D" in string 00797 number.replace(position,1,"e"); 00798 return true; 00799 } 00800 else 00801 // we assume that if this one number is written correctly, all numbers are 00802 return false; 00803 } 00804 00805 00806 00807 void MeshDataUnvHeader::which_dataset (const unsigned int ds_label) 00808 { 00809 this->_desired_dataset_label = ds_label; 00810 } 00811 00812 00813 00814 void MeshDataUnvHeader::operator = (const MeshDataUnvHeader& omduh) 00815 { 00816 this->dataset_label = omduh.dataset_label; 00817 this->dataset_name = omduh.dataset_name; 00818 this->dataset_location = omduh.dataset_location; 00819 this->id_lines_1_to_5 = omduh.id_lines_1_to_5; 00820 00821 this->model_type = omduh.model_type; 00822 this->analysis_type = omduh.analysis_type; 00823 this->data_characteristic = omduh.data_characteristic; 00824 this->result_type = omduh.result_type; 00825 00826 #ifdef LIBMESH_USE_COMPLEX_NUMBERS 00827 /* 00828 * in complex mode allow only 00829 * values 5 or 6 (complex) for data_type 00830 */ 00831 if ((omduh.data_type == 5) || 00832 (omduh.data_type == 6)) 00833 this->data_type = omduh.data_type; 00834 else 00835 { 00836 # ifdef DEBUG 00837 libMesh::err << "WARNING: MeshDataUnvHeader::operator=(): Other object has data_type for" << std::endl 00838 << " real values. Will use default data_type=5 during assignment." << std::endl 00839 << std::endl; 00840 # endif 00841 this->data_type = 5; 00842 } 00843 00844 #else 00845 00846 /* 00847 * in real mode allow only 00848 * values 2 or 4 (real) for data_type 00849 */ 00850 if ((omduh.data_type == 2) || 00851 (omduh.data_type == 4)) 00852 this->data_type = omduh.data_type; 00853 else 00854 { 00855 # ifdef DEBUG 00856 libMesh::err << "WARNING: Other MeshDataUnvHeader has data_type for complex values." << std::endl 00857 << " Data import will likely _not_ work and result in infinite loop," << std::endl 00858 << " provided the user forgot to re-size nvaldc to 2*nvaldc_old!" << std::endl 00859 << std::endl; 00860 # endif 00861 this->data_type = 2; 00862 } 00863 00864 #endif 00865 00866 this->nvaldc = omduh.nvaldc; 00867 00868 this->record_10 = omduh.record_10; 00869 this->record_11 = omduh.record_11; 00870 this->record_12 = omduh.record_12; 00871 this->record_13 = omduh.record_13; 00872 00873 this->_desired_dataset_label = omduh._desired_dataset_label; 00874 } 00875 00876 00877 00878 00879 bool MeshDataUnvHeader::operator == (const MeshDataUnvHeader& omduh) const 00880 { 00881 return (this->dataset_label == omduh.dataset_label && 00882 this->dataset_name == omduh.dataset_name && 00883 this->dataset_location == omduh.dataset_location && 00884 this->id_lines_1_to_5 == omduh.id_lines_1_to_5 && 00885 00886 this->model_type == omduh.model_type && 00887 this->analysis_type == omduh.analysis_type && 00888 this->data_characteristic == omduh.data_characteristic && 00889 this->result_type == omduh.result_type && 00890 00891 this->data_type == omduh.data_type && 00892 this->nvaldc == omduh.nvaldc && 00893 00894 this->record_10 == omduh.record_10 && 00895 this->record_11 == omduh.record_11 && 00896 this->record_12 == omduh.record_12 && 00897 this->record_13 == omduh.record_13 && 00898 00899 this->_desired_dataset_label == omduh._desired_dataset_label); 00900 } 00901 00902 } // namespace libMesh