57 std::ostringstream error_message;
61 error_message <<
"Range Error: Value " << i
62 <<
" is not in the range (0," 68 error_message <<
"Range Error: Time Value " << t
69 <<
" is not in the range (0," 74 OOMPH_CURRENT_FUNCTION,
75 OOMPH_EXCEPTION_LOCATION);
87 const unsigned n_copies =
Ncopies;
89 Data** new_copy_of_data_pt =
new Data*[n_copies+1];
91 for(
unsigned i=0;
i<n_copies;
i++)
94 new_copy_of_data_pt[n_copies] = data_pt;
111 const unsigned n_copies =
Ncopies;
113 unsigned data_index = n_copies;
115 for(
unsigned i=0;
i<n_copies;
i++)
121 if(data_index==n_copies)
123 std::ostringstream error_stream;
124 error_stream <<
"Data pointer " << data_pt
125 <<
" is not stored as a copy of the data object " <<
this 128 OOMPH_CURRENT_FUNCTION,
129 OOMPH_EXCEPTION_LOCATION);
134 Data** new_copy_of_data_pt =
new Data*[n_copies-1];
138 for(
unsigned i=0;
i<n_copies;
i++)
168 OOMPH_CURRENT_FUNCTION,
169 OOMPH_EXCEPTION_LOCATION);
182 OOMPH_CURRENT_FUNCTION,
183 OOMPH_EXCEPTION_LOCATION);
260 if(initial_n_value > 0)
264 Value =
new double*[initial_n_value];
269 double *values =
new double[initial_n_value];
273 for(
unsigned i=0;
i<initial_n_value;
i++)
291 const unsigned &initial_n_value,
292 const bool &allocate_storage)
304 if((allocate_storage) && (initial_n_value > 0))
314 Value =
new double*[initial_n_value];
317 double *values =
new double[initial_n_value*n_tstorage];
320 for(
unsigned i=0;
i<initial_n_value;
i++)
324 Value[
i] = &values[
i*n_tstorage];
326 for(
unsigned t=0;
t<n_tstorage;
t++) {
Value[
i][
t] = 0.0;}
340 out <<
"Data: [" << std::endl;
342 for(
unsigned j=0; j<
nvalue; j++)
344 out <<
"global eq " << d.
eqn_number(j) <<
": [";
345 for(
unsigned t=0;
t<nt-1;
t++)
347 out << d.
value(
t, j) <<
", ";
349 out << d.
value(nt-1, j) <<
"]" << std::endl;
351 out <<
"]" << std::endl;
362 const unsigned dim = nd.
ndim();
366 out <<
"Position: [";
367 for(
unsigned j=0; j<dim; j++)
369 out <<
"dimension " << dim <<
": [";
370 for(
unsigned t=0;
t<nt-1;
t++)
372 out << nd.
x(
t, j) <<
", ";
374 out << nd.
x(nt-1, j) <<
"]" << std::endl;
376 out <<
"]" << std::endl;
381 out << dynamic_cast<const Data&>(nd);
393 const bool &preserve_existing_data)
400 unsigned n_preserved_tstorage = 1;
401 if(preserve_existing_data) {n_preserved_tstorage = this->
ntstorage();}
410 const unsigned n_value =
nvalue();
416 const unsigned n_tstorage = time_stepper_pt->
ntstorage();
419 double *values =
new double[n_value*n_tstorage];
423 if(n_tstorage < n_preserved_tstorage) {n_preserved_tstorage = n_tstorage;}
424 for(
unsigned i=0;
i<n_value;
i++)
426 for(
unsigned t=0;
t<n_preserved_tstorage;
t++)
436 for(
unsigned i=0;
i<n_value;
i++)
438 Value[
i] = &values[
i*n_tstorage];
440 for(
unsigned t=n_preserved_tstorage;
t<n_tstorage;
t++) {
Value[
i][
t] = 0.0;}
476 const unsigned n_value =
nvalue();
477 for(
unsigned i=0;
i<n_value;
i++) {values[
i] =
value(
i);}
487 const unsigned n_value =
nvalue();
488 for(
unsigned i=0;
i<n_value;
i++) {values[
i] =
value(t,
i);}
504 const unsigned eqn_number_range =
nvalue();
505 for(
unsigned i=0;
i<eqn_number_range;
i++)
511 std::ostringstream warn_message;
513 <<
"Node::assign_eqn_numbers(...) noticed that " <<
i <<
" -th value\n" 514 <<
"is hanging but not constrained. This shouldn't happen and is\n" 515 <<
"probably because a hanging value was unpinned manually\n" 516 <<
"Rectifying this now...\n";
518 OOMPH_CURRENT_FUNCTION,
519 OOMPH_EXCEPTION_LOCATION);
536 if(
Value==0) {
return false;}
539 const unsigned n_value =
nvalue();
541 const unsigned n_storage = n_value*n_time;
544 double *local_value_pt =
Value[0];
547 for(
unsigned i=0;
i<n_storage;++
i)
549 if(parameter_pt==(local_value_pt+
i)) {
return true;}
565 const unsigned n_value =
nvalue();
569 const unsigned long n_value_orig=orig_data_pt->
nvalue();
570 if (n_value!=n_value_orig)
572 std::ostringstream error_stream;
573 error_stream <<
"The number of values, " << n_value
574 <<
" is not the same of those in the original data " 575 << n_value_orig << std::endl;
578 OOMPH_CURRENT_FUNCTION,
579 OOMPH_EXCEPTION_LOCATION);
581 const unsigned long n_time_orig=orig_data_pt->
ntstorage();
582 if (n_time!=n_time_orig)
584 std::ostringstream error_stream;
585 error_stream <<
"The number of time history values, " << n_time
586 <<
" is not the same of those in the original data " 587 << n_time_orig << std::endl;
590 OOMPH_CURRENT_FUNCTION,
591 OOMPH_EXCEPTION_LOCATION);
595 for(
unsigned t=0;
t<n_time;
t++)
597 for(
unsigned j=0;j<n_value;j++)
611 const unsigned value_pt_range =
nvalue();
612 const unsigned time_steps_range =
ntstorage();
615 if (value_pt_range*time_steps_range > 0)
617 dump_file << value_pt_range <<
" # number of data values" << std::endl;
618 dump_file << time_steps_range <<
" # number of doubles for time history" 622 for(
unsigned t=0;
t<time_steps_range;
t++)
624 for(
unsigned j=0;j<value_pt_range;j++)
626 dump_file <<
value(
t,j) << std::endl ;
638 std::ostringstream error_stream;
641 const unsigned value_pt_range =
nvalue();
642 const unsigned time_steps_range =
ntstorage();
645 if (value_pt_range*time_steps_range > 0)
648 getline(restart_file,input_string,
'#');
650 restart_file.ignore(80,
'\n');
652 const unsigned long check_nvalues=atoi(input_string.c_str());
653 if (check_nvalues!=value_pt_range)
656 <<
"Number of values stored in dump file is not equal to the amount " 657 <<
"of storage allocated in Data object " 658 << check_nvalues <<
" " << value_pt_range;
659 if (check_nvalues>value_pt_range)
661 error_stream <<
" [ignoring extra entries]";
663 error_stream << std::endl;
664 Node* nod_pt=
dynamic_cast<Node*
>(
this);
667 unsigned n_dim=nod_pt->
ndim();
668 error_stream <<
"Node coordinates: ";
669 for (
unsigned i=0;
i<n_dim;
i++)
671 error_stream << nod_pt->
x(
i) <<
" ";
673 error_stream << nod_pt <<
" ";
675 if (nod_pt->is_halo())
677 error_stream <<
" (halo)\n";
681 error_stream <<
" (not halo)\n";
685 if (check_nvalues<value_pt_range)
688 OOMPH_CURRENT_FUNCTION,
689 OOMPH_EXCEPTION_LOCATION);
694 getline(restart_file,input_string,
'#');
697 restart_file.ignore(80,
'\n');
700 const unsigned check_ntvalues=atoi(input_string.c_str());
703 if (check_ntvalues<time_steps_range)
705 std::ostringstream warning_stream;
707 <<
"Number of time history values in dump file is less " 708 <<
"than the storage allocated in Data object: " 709 << check_ntvalues <<
" " << time_steps_range << std::endl;
711 <<
"We're using steady data as initial data for unsteady \n" 712 <<
"run. I'll fill in the remaining history values with zeroes. \n" 713 <<
"If you don't like this \n" 714 <<
"you'll have to overwrite this yourself with whatever is \n " 715 <<
"appropriate for your timestepping scheme. \n";
719 OOMPH_EXCEPTION_LOCATION);
722 for(
unsigned t=0;
t<time_steps_range;
t++)
724 for(
unsigned j=0;j<check_nvalues;j++)
729 getline(restart_file,input_string);
732 if (j<value_pt_range)
739 <<
"Not setting j=" << j
740 <<
" -th history restart value [t = " <<
t <<
" ] to " 741 << atof(input_string.c_str()) <<
" because Data " 742 <<
" hasn't been sufficiently resized\n";
747 if (j<value_pt_range)
754 <<
"Not setting j=" << j
755 <<
" -th restart history value [t = " <<
t <<
" ] to " 756 << 0.0 <<
" because Data " 757 <<
" hasn't been sufficiently resized\n";
764 else if (check_ntvalues>time_steps_range)
766 std::ostringstream warning_stream;
768 <<
"Warning: number of time history values in dump file is greater " 769 <<
"than the storage allocated in Data object: " 770 << check_ntvalues <<
" " << time_steps_range << std::endl;
771 warning_stream <<
"We're using the current values from an unsteady \n" 772 <<
"restart file to initialise a static run. \n";
776 OOMPH_EXCEPTION_LOCATION);
779 for(
unsigned t=0;
t<check_ntvalues;
t++)
781 for(
unsigned j=0;j<check_nvalues;j++)
784 getline(restart_file,input_string);
788 if (j<value_pt_range)
795 <<
"Not setting j=" << j
796 <<
" -th restart history value [t = " <<
t <<
" ] to " 797 << atof(input_string.c_str()) <<
" because Data " 798 <<
" hasn't been sufficiently resized\n";
808 for(
unsigned t=0;
t<time_steps_range;
t++)
810 for(
unsigned j=0;j<check_nvalues;j++)
813 getline(restart_file,input_string);
816 if (j<value_pt_range)
822 error_stream <<
"Not setting j=" << j
823 <<
" -th restart history value [t = " <<
t <<
" ] to " 824 << atof(input_string.c_str()) <<
" because Data " 825 <<
" hasn't been sufficiently resized\n";
830 if (check_nvalues>value_pt_range)
834 OOMPH_EXCEPTION_LOCATION);
867 const unsigned eqn_number_range =
Nvalue;
868 for(
unsigned i=0;
i<eqn_number_range;
i++)
909 const unsigned eqn_number_range =
Nvalue;
910 for(
unsigned i=0;
i<eqn_number_range;
i++)
919 out<<
"Eqn: "<<eqn_number<<
" | Value "<<
i<<current_string<<std::endl;
936 const unsigned eqn_number_range =
Nvalue;
937 for(
unsigned i=0;
i<eqn_number_range;
i++)
944 <<
"\n ERROR: Failed Data::self_test() for i=" <<
i << std::endl;
946 <<
" (Value is not classified as pinned or free)" << std::endl;
951 if (passed) {
return 0;}
964 const unsigned n_value_old =
nvalue();
966 const unsigned n_value_new = n_value;
969 if(n_value_new==n_value_old) {
return;}
973 if(n_value_new < n_value_old)
975 std::ostringstream error_stream;
977 <<
"Warning : Data cannot be resized to a smaller value!" << std::endl;
979 OOMPH_CURRENT_FUNCTION,
980 OOMPH_EXCEPTION_LOCATION);
989 double **value_new_pt =
new double*[n_value_new];
990 long *eqn_number_new =
new long[n_value_new];
993 double *values =
new double[n_value_new*t_storage];
996 for(
unsigned i=0;
i<n_value_old;
i++)
999 value_new_pt[
i] = &values[
i*t_storage];
1001 for(
unsigned t=0;
t<t_storage;
t++)
1009 for(
unsigned i=n_value_old;
i<n_value_new;
i++)
1012 value_new_pt[
i] = &values[
i*t_storage];
1014 for(
unsigned t=0;
t<t_storage;
t++) {value_new_pt[
i][
t] = 0.0;}
1024 if (n_value_old!=0)
delete[]
Value[0];
1026 Value = value_new_pt;
1044 const unsigned n_value = this->
nvalue();
1046 for(
unsigned i=0;
i<n_value;
i++)
1052 map_of_value_pt[
static_cast<unsigned>(global_eqn)] =
1058 #ifdef OOMPH_HAS_MPI 1068 const unsigned n_value = this->
nvalue();
1073 if(n_value==0) {
return;}
1078 const unsigned n_tstorage = this->
ntstorage();
1081 const unsigned n_current_value = vector_of_values.size();
1089 vector_of_values.resize(n_current_value + n_tstorage*n_value + n_debug);
1092 unsigned index = n_current_value;
1095 vector_of_values[index++]=n_tstorage;
1096 vector_of_values[index++]=n_value;
1098 if(n_value==0) {
return;}
1102 double* data_pt =
Value[0];
1105 for(
unsigned i=0;
i<n_value;
i++)
1108 for(
unsigned t=0;
t<n_tstorage;
t++)
1111 vector_of_values[index] = *data_pt;
1133 unsigned n_value = this->
nvalue();
1136 const unsigned n_tstorage = this->
ntstorage();
1139 unsigned orig_n_tstorage=unsigned(vector_of_values[index++]);
1140 unsigned orig_n_value=unsigned(vector_of_values[index++]);
1141 if ((orig_n_tstorage!=n_tstorage)||(orig_n_value!=n_value))
1143 std::ostringstream error_stream;
1144 error_stream <<
"Non-matching number of values:\n" 1145 <<
"sent and local n_tstorage: " << orig_n_tstorage <<
" " 1146 << n_tstorage << std::endl
1147 <<
"sent and local n_value: " << orig_n_value <<
" " 1148 << n_value << std::endl;
1150 OOMPH_CURRENT_FUNCTION,
1151 OOMPH_EXCEPTION_LOCATION);
1156 if(n_value==0) {
return;}
1159 double* data_pt =
Value[0];
1162 for(
unsigned i=0;
i<n_value;
i++)
1165 for(
unsigned t=0;
t<n_tstorage;
t++)
1168 *data_pt = vector_of_values[index];
1184 const unsigned n_value = this->
nvalue();
1186 if(n_value==0) {
return;}
1189 const unsigned n_current_value = vector_of_eqn_numbers.size();
1190 vector_of_eqn_numbers.resize(n_current_value + n_value);
1193 unsigned index = n_current_value;
1197 for(
unsigned i=0;
i<n_value;
i++)
1217 const Vector<long> &vector_of_eqn_numbers,
unsigned &index)
1220 const unsigned n_value = this->
nvalue();
1222 if(n_value==0) {
return;}
1227 for(
unsigned i=0;
i<n_value;
i++)
1230 *eqn_number_pt = vector_of_eqn_numbers[index];
1247 Value = &Copied_data_pt->Value[Copied_index];
1250 Eqn_number = &Copied_data_pt->Eqn_number[Copied_index];
1273 Copied_data_pt(data_pt),
1274 Copied_index(copied_index)
1279 std::ostringstream error_stream;
1280 error_stream <<
"The data you are trying to hijack is already a copy" 1282 error_stream <<
"Please copy the original data" << std::endl;
1283 error_stream <<
"In a later version, I might do this for you," 1284 <<
" but not today" << std::endl;
1287 OOMPH_CURRENT_FUNCTION,
1288 OOMPH_EXCEPTION_LOCATION);
1306 OOMPH_CURRENT_FUNCTION,
1307 OOMPH_EXCEPTION_LOCATION);
1355 std::ostringstream error_stream;
1356 error_stream <<
"The data you are trying to copy is already a copy" 1358 error_stream <<
"Please copy the original data" << std::endl;
1359 error_stream <<
"In a later version, I might do this for you," 1360 <<
" but not today" << std::endl;
1363 OOMPH_CURRENT_FUNCTION,
1364 OOMPH_EXCEPTION_LOCATION);
1381 OOMPH_CURRENT_FUNCTION,
1382 OOMPH_EXCEPTION_LOCATION);
1403 std::ostringstream error_message;
1404 error_message <<
"Range Error: the index " << i
1405 <<
" is not in the range (0," 1406 << Nmaster-1 <<
")";
1408 OOMPH_CURRENT_FUNCTION,
1409 OOMPH_EXCEPTION_LOCATION);
1418 Node*
const &master_node_pt_,
1419 const double &weight)
1421 #ifdef RANGE_CHECKING 1424 Master_nodes_pt[
i] = master_node_pt_;
1425 Master_weights[
i] = weight;
1433 const double &weight)
1436 const unsigned n_master = Nmaster;
1438 Node* *new_master_nodes_pt =
new Node*[n_master+1];
1439 double *new_master_weights =
new double[n_master+1];
1442 for(
unsigned i=0;
i<n_master;
i++)
1444 new_master_nodes_pt[
i] = Master_nodes_pt[
i];
1445 new_master_weights[
i] = Master_weights[
i];
1448 new_master_nodes_pt[n_master] = master_node_pt_;
1449 new_master_weights[n_master] = weight;
1452 delete[] Master_nodes_pt; Master_nodes_pt = new_master_nodes_pt;
1453 delete[] Master_weights; Master_weights = new_master_weights;
1470 const unsigned &
i)
const 1473 const unsigned position_ntstorage = Position_time_stepper_pt->ntstorage();
1475 if((i >= Ndim) || (k >= Nposition_type) ||
1476 (t >= position_ntstorage))
1478 std::ostringstream error_message;
1482 error_message <<
"Range Error: X coordinate " << i
1483 <<
" is not in the range (0," 1487 if(k >= Nposition_type)
1489 error_message <<
"Range Error: Position type " << k
1490 <<
" is not in the range (0," 1491 << Nposition_type-1 <<
")";
1494 if(t >= position_ntstorage)
1496 error_message <<
"Range Error: Position Time Value " << t
1497 <<
" is not in the range (0," 1498 << position_ntstorage - 1 <<
")";
1502 OOMPH_CURRENT_FUNCTION,
1503 OOMPH_EXCEPTION_LOCATION);
1520 Ndim(0), Nposition_type(0), Obsolete(false),
1521 Aux_node_update_fct_pt(0)
1536 const unsigned &n_position_type,
1537 const unsigned &initial_n_value,
1538 const bool &allocate_x_position) :
1539 Data(initial_n_value),
1551 const unsigned n_storage = n_dim*n_position_type;
1555 if(allocate_x_position)
1561 double *x_positions =
new double[n_storage];
1564 for(
unsigned j=0;j<n_storage;j++)
1584 const unsigned &n_dim,
1585 const unsigned &n_position_type,
1586 const unsigned &initial_n_value,
1587 const bool &allocate_x_position)
1588 :
Data(time_stepper_pt_,initial_n_value),
1599 const unsigned n_storage = n_dim*n_position_type;
1602 if(allocate_x_position)
1611 double *x_positions =
new double[n_storage*n_tstorage];
1614 for(
unsigned j=0;j<n_storage;j++)
1638 const unsigned nhang =
nvalue() + 1;
1639 for(
unsigned ival=1;ival<nhang;ival++)
1680 const bool &preserve_existing_data)
1686 unsigned n_preserved_tstorage =1;
1687 if(preserve_existing_data)
1700 double *x_positions =
new double[n_storage*n_tstorage];
1704 if(n_tstorage < n_preserved_tstorage) {n_preserved_tstorage = n_tstorage;}
1707 for(
unsigned j=0;j<n_storage;++j)
1709 for(
unsigned t=0;
t<n_preserved_tstorage;
t++)
1711 x_positions[j*n_tstorage +
t] = this->
X_position[j][
t];
1719 for(
unsigned j=0;j<n_storage;j++)
1724 for(
unsigned t=n_preserved_tstorage;
t<n_tstorage;
t++)
1746 for(
unsigned t=0;
t<n_time;
t++)
1770 for(
unsigned t=0;
t<n_time;
t++)
1795 for(
unsigned t=0;
t<n_time;
t++)
1809 const unsigned &
i)
const 1820 for(
unsigned t=0;
t<n_time;
t++)
1841 const unsigned long npos_storage_orig
1843 if (npos_storage!=npos_storage_orig)
1845 std::ostringstream error_stream;
1846 error_stream <<
"The allocated positional storage " 1847 << npos_storage <<
" is not the same as the original Node " 1848 << npos_storage_orig << std::endl;
1851 OOMPH_CURRENT_FUNCTION,
1852 OOMPH_EXCEPTION_LOCATION);
1859 const unsigned long n_time_orig =
1861 if (n_time!=n_time_orig)
1863 std::ostringstream error_stream;
1864 error_stream <<
"The number of positional time history values, " 1866 <<
" is not the same of those in the original node " 1867 << n_time_orig << std::endl;
1870 OOMPH_CURRENT_FUNCTION,
1871 OOMPH_EXCEPTION_LOCATION);
1875 for(
unsigned t=0;
t<n_time;
t++)
1877 for(
unsigned j=0;j<npos_storage;j++)
1896 dump_file << npos_storage
1897 <<
" # number of fixed position variables" << std::endl;
1900 dump_file << Time_steps_range
1901 <<
" # total number of doubles for time history (incl present)" 1904 for(
unsigned t=0;
t<Time_steps_range;
t++)
1906 for(
unsigned j=0;j<npos_storage;j++)
1928 getline(restart_file,input_string,
'#');
1930 restart_file.ignore(80,
'\n');
1932 const unsigned long check_npos_storage=atoi(input_string.c_str());
1933 if (check_npos_storage!=npos_storage)
1935 std::ostringstream error_stream;
1936 error_stream <<
"The allocated positional storage " 1938 " is not the same as that in the input file" 1939 << check_npos_storage << std::endl;
1942 OOMPH_CURRENT_FUNCTION,
1943 OOMPH_EXCEPTION_LOCATION);
1951 getline(restart_file,input_string,
'#');
1953 restart_file.ignore(80,
'\n');
1955 const unsigned long check_time_steps_range=atoi(input_string.c_str());
1956 if (check_time_steps_range!=time_steps_range)
1958 std::ostringstream error_stream;
1960 <<
"Number of positional history values in dump file is less " 1961 <<
"than the storage allocated in Node object: " 1962 << check_time_steps_range
1963 <<
" " << time_steps_range << std::endl;
1966 OOMPH_CURRENT_FUNCTION,
1967 OOMPH_EXCEPTION_LOCATION);
1971 for(
unsigned t=0;
t<time_steps_range;
t++)
1973 for(
unsigned j=0;j<npos_storage;j++)
1976 getline(restart_file,input_string);
2001 unsigned n_hang =
nvalue() + 1;
2009 for(
unsigned n=0;n<n_hang;n++) {
Hanging_pt[n] = 0;}
2016 std::vector<bool> Same_as_geometric(n_hang,
true);
2019 for(
unsigned n=1;n<n_hang;n++)
2040 for(
unsigned n=1;n<n_hang;n++)
2042 if(Same_as_geometric[n]==
true)
2093 unsigned old_nvalue=
nvalue();
2100 backup_hanging_pt =
new HangInfo*[old_nvalue+1];
2103 for(
unsigned i=0;
i<old_nvalue+1;
i++)
2118 if (backup_hanging_pt!=0)
2121 const unsigned n_hang = n_value+1;
2127 for(
unsigned i=0;
i<=old_nvalue;
i++)
2133 for(
unsigned i=old_nvalue+1;
i<n_hang;
i++)
2168 delete [] backup_hanging_pt;
2182 throw OomphLibError(
"Only BoundaryNodes can be made periodic",
2183 OOMPH_CURRENT_FUNCTION,
2184 OOMPH_EXCEPTION_LOCATION);
2195 throw OomphLibError(
"Only BoundaryNodes can make periodic nodes",
2196 OOMPH_CURRENT_FUNCTION,
2197 OOMPH_EXCEPTION_LOCATION);
2209 const unsigned nhang =
nvalue() + 1;
2210 for(
unsigned ival=1;ival<nhang;ival++)
2245 std::stringstream ss;
2246 ss <<
"Node (bas class) can't have boundary coordinates\n";
2248 OOMPH_CURRENT_FUNCTION,
2249 OOMPH_EXCEPTION_LOCATION);
2259 std::stringstream ss;
2260 ss <<
"Cannot add non BoundaryNode<NODE> to boundary " << b <<
"\n";
2262 OOMPH_CURRENT_FUNCTION,
2263 OOMPH_EXCEPTION_LOCATION);
2274 throw OomphLibError(
"Cannot remove non BoundaryNode<NODE> to boundary",
2275 OOMPH_CURRENT_FUNCTION,
2276 OOMPH_EXCEPTION_LOCATION);
2287 throw OomphLibError(
"Non-boundary Node cannot have boundary coordinates",
2288 OOMPH_CURRENT_FUNCTION,
2289 OOMPH_EXCEPTION_LOCATION);
2304 throw OomphLibError(
"Non-boundary Node cannot have boundary coordinates",
2305 OOMPH_CURRENT_FUNCTION,
2306 OOMPH_EXCEPTION_LOCATION);
2318 throw OomphLibError(
"Non-boundary Node cannot have boundary coordinates",
2319 OOMPH_CURRENT_FUNCTION,
2320 OOMPH_EXCEPTION_LOCATION);
2339 for(
unsigned m=0;m<n_master;m++)
2366 for(
unsigned m=0;m<n_master;m++)
2383 const unsigned n_value =
nvalue();
2384 for(
unsigned i=0;
i<n_value;
i++)
2399 const unsigned n_value =
nvalue();
2400 for(
unsigned i=0;
i<n_value;
i++)
2416 const unsigned n_dim =
ndim();
2428 const unsigned n_dim =
ndim();
2446 double interpolated_position=0.0;
2450 for (
unsigned m=0;m<n_master;m++)
2455 posn=interpolated_position;
2475 double interpolated_position=0.0;
2479 for (
unsigned m=0;m<n_master;m++)
2481 interpolated_position+=
2485 posn=interpolated_position;
2505 double interpolated_position=0.0;
2509 for (
unsigned m=0;m<n_master;m++)
2511 interpolated_position+=
2515 posn=interpolated_position;
2526 const unsigned &
i)
const 2536 double interpolated_position=0.0;
2540 for (
unsigned m=0;m<n_master;m++)
2542 interpolated_position+=
2546 posn=interpolated_position;
2567 for(
unsigned t=0;
t<n_time;
t++)
2591 for(
unsigned t=0;
t<n_time;
t++)
2617 for(
unsigned t=0;
t<n_time;
t++)
2632 const unsigned &
i)
const 2643 for(
unsigned t=0;
t<n_time;
t++)
2659 const unsigned n_dim = this->
ndim();
2660 for (
unsigned i=0;
i<n_dim;
i++) {outfile <<
x(
i) <<
" ";}
2661 outfile << std::endl;
2666 #ifdef OOMPH_HAS_MPI 2685 const unsigned n_current_value = vector_of_values.size();
2693 vector_of_values.resize(n_current_value + n_tstorage*n_storage+n_debug);
2696 unsigned index = n_current_value;
2699 vector_of_values[index++]=n_storage;
2700 vector_of_values[index++]=n_tstorage;
2708 for(
unsigned i=0;
i<n_storage;
i++)
2711 for(
unsigned t=0;
t<n_tstorage;
t++)
2714 vector_of_values[index] = *data_pt;
2741 unsigned orig_n_storage=unsigned(vector_of_values[index++]);
2742 unsigned orig_n_tstorage=unsigned(vector_of_values[index++]);
2743 if ((orig_n_tstorage!=n_tstorage)||(orig_n_storage!=n_storage))
2745 std::ostringstream error_stream;
2746 error_stream <<
"Non-matching number of values:\n" 2747 <<
"sent and local n_tstorage: " << orig_n_tstorage <<
" " 2748 << n_tstorage << std::endl
2749 <<
"sent and local n_storage: " << orig_n_storage <<
" " 2750 << n_storage << std::endl;
2752 OOMPH_CURRENT_FUNCTION,
2753 OOMPH_EXCEPTION_LOCATION);
2761 for(
unsigned i=0;
i<n_storage;
i++)
2764 for(
unsigned t=0;
t<n_tstorage;
t++)
2767 *data_pt = vector_of_values[index];
2798 bool already_a_copy =
false;
2799 already_a_copy |= copied_node_pt->
is_a_copy();
2800 const unsigned n_periodic = periodic_copies_pt.size();
2801 for(
unsigned n=0;n<n_periodic;n++)
2803 already_a_copy |= periodic_copies_pt[n]->is_a_copy();
2809 std::ostringstream error_stream;
2811 "The nodes you are trying to make periodic are already periodic\n" 2813 "Or you are trying to make a copy of another already periodic node\n";
2814 error_stream <<
"Please copy the original data if you can\n";
2816 OOMPH_CURRENT_FUNCTION,
2817 OOMPH_EXCEPTION_LOCATION);
2822 for(
unsigned n=0;n<n_periodic;n++)
2825 Node*
const nod_pt = periodic_copies_pt[n];
2827 if(nod_pt != copied_node_pt)
2830 nod_pt->delete_value_storage();
2832 nod_pt->Value = copied_node_pt->Value;
2833 nod_pt->Eqn_number = copied_node_pt->Eqn_number;
2839 copied_node_pt->add_copy(nod_pt);
2858 std::ostringstream error_stream;
2860 "The node you are trying to make into a periodic copy is already a copy\n.";
2862 OOMPH_CURRENT_FUNCTION,
2863 OOMPH_EXCEPTION_LOCATION);
2881 node_pt->delete_value_storage();
2883 node_pt->Value = copied_node_pt->Value;
2884 node_pt->Eqn_number = copied_node_pt->Eqn_number;
2887 copied_node_pt->add_copy(node_pt);
2897 delete Boundaries_pt;
2901 if(Boundary_coordinates_pt != 0)
2905 = Boundary_coordinates_pt->begin();
2906 it!=Boundary_coordinates_pt->end();++it)
2914 delete Boundary_coordinates_pt;
2916 Boundary_coordinates_pt=0;
2920 delete Index_of_first_value_assigned_by_face_element_pt;
2921 Index_of_first_value_assigned_by_face_element_pt=0;
2937 if(Boundaries_pt==0) {Boundaries_pt =
new std::set<unsigned>;}
2953 Boundaries_pt->insert(b);
2967 std::ostringstream error_stream;
2968 error_stream <<
"Node is not on boundary " << b << std::endl;
2971 OOMPH_CURRENT_FUNCTION,
2972 OOMPH_EXCEPTION_LOCATION);
2977 Boundaries_pt->erase(b);
2981 if(Boundary_coordinates_pt!=0)
2984 delete (*Boundary_coordinates_pt)[b];
2986 Boundary_coordinates_pt->erase(b);
2990 if(Boundaries_pt->size()==0)
2992 delete Boundaries_pt;
3003 if(Boundaries_pt!=0)
3005 if(find(Boundaries_pt->begin(),Boundaries_pt->end(),b)
3006 != Boundaries_pt->end()) {
return true;}
3021 if(Boundaries_pt==0)
3024 OOMPH_CURRENT_FUNCTION,
3025 OOMPH_EXCEPTION_LOCATION);
3032 std::ostringstream error_stream;
3033 error_stream <<
"Node is not on boundary " << b << std::endl;
3036 OOMPH_CURRENT_FUNCTION,
3037 OOMPH_EXCEPTION_LOCATION);
3041 if(Boundary_coordinates_pt == 0)
3043 std::ostringstream error_stream;
3044 error_stream <<
"Boundary coordinates have not been set\n" 3045 <<
"[Note: In refineable problems, the boundary coordinates\n" 3046 <<
" will only be interpolated to newly created nodes\n" 3047 <<
" if Mesh::Boundary_coordinate_exists[...] has been\n" 3048 <<
" set to true!]\n";
3050 OOMPH_CURRENT_FUNCTION,
3051 OOMPH_EXCEPTION_LOCATION);
3056 return (*Boundary_coordinates_pt)[b]->nrow();
3072 if(Boundaries_pt==0)
3075 OOMPH_CURRENT_FUNCTION,
3076 OOMPH_EXCEPTION_LOCATION);
3083 std::ostringstream error_stream;
3084 error_stream <<
"Node is not on boundary " << b << std::endl;
3087 OOMPH_CURRENT_FUNCTION,
3088 OOMPH_EXCEPTION_LOCATION);
3094 if(Boundary_coordinates_pt == 0)
3096 std::ostringstream error_stream;
3097 error_stream <<
"Boundary coordinates have not been set\n" 3098 <<
"[Note: In refineable problems, the boundary coordinates\n" 3099 <<
" will only be interpolated to newly created nodes\n" 3100 <<
" if Mesh::Boundary_coordinate_exists[...] has been\n" 3101 <<
" set to true!]\n";
3103 OOMPH_CURRENT_FUNCTION,
3104 OOMPH_EXCEPTION_LOCATION);
3110 const unsigned nboundary_coord = (*Boundary_coordinates_pt)[b]->nrow();
3112 if(nboundary_coord != boundary_zeta.size())
3114 std::ostringstream error_stream;
3116 <<
"Wrong number of coordinates in the vector boundary_zeta" 3117 << std::endl <<
"There are " << nboundary_coord
3118 <<
" boundary coordinates" 3119 << std::endl <<
"But bounday_zeta() has size " << boundary_zeta.size()
3123 OOMPH_CURRENT_FUNCTION,
3124 OOMPH_EXCEPTION_LOCATION);
3129 for(
unsigned i=0;
i<nboundary_coord;
i++)
3130 {boundary_zeta[
i] = (*(*Boundary_coordinates_pt)[b])(
i,k);}
3144 if(Boundaries_pt==0)
3147 OOMPH_CURRENT_FUNCTION,
3148 OOMPH_EXCEPTION_LOCATION);
3155 std::ostringstream error_stream;
3156 error_stream <<
"Node is not on boundary " << b << std::endl;
3159 OOMPH_CURRENT_FUNCTION,
3160 OOMPH_EXCEPTION_LOCATION);
3164 if(Boundary_coordinates_pt == 0)
3166 Boundary_coordinates_pt =
new std::map<unsigned,DenseMatrix<double> *>;
3171 const unsigned nboundary_coord = boundary_zeta.size();
3174 if((*Boundary_coordinates_pt)[b] == 0)
3177 (*Boundary_coordinates_pt)[b] =
3185 unsigned ncol=(*Boundary_coordinates_pt)[b]->
ncol();
3187 (*Boundary_coordinates_pt)[b]->resize(nboundary_coord,ncol);
3191 if ((k+1)>(*Boundary_coordinates_pt)[b]->ncol())
3193 (*Boundary_coordinates_pt)[b]->resize(nboundary_coord,k+1);
3198 for(
unsigned i=0;
i<nboundary_coord;
i++)
3199 {(*(*Boundary_coordinates_pt)[b])(
i,k) = boundary_zeta[
i];}
3219 if((i >= Nlagrangian) || (k >= Nlagrangian_type))
3221 std::ostringstream error_message;
3223 if(i >= Nlagrangian)
3225 error_message <<
"Range Error: Xi coordinate " << i
3226 <<
" is not in the range (0," 3227 << Nlagrangian-1 <<
")";
3230 if(k >= Nlagrangian_type)
3232 error_message <<
"Range Error: Lagrangian type " << k
3233 <<
" is not in the range (0," 3234 << Nlagrangian_type-1 <<
")";
3238 OOMPH_CURRENT_FUNCTION,
3239 OOMPH_EXCEPTION_LOCATION);
3256 const unsigned &n_lagrangian_type,
3257 const unsigned &n_dim,
3258 const unsigned &n_position_type,
3259 const unsigned &initial_n_value)
3260 :
Node(n_dim,n_position_type,initial_n_value,false),
3261 Nlagrangian(n_lagrangian), Nlagrangian_type(n_lagrangian_type)
3272 const unsigned n_lagrangian_storage = n_lagrangian*n_lagrangian_type;
3275 for(
unsigned j=0;j<n_lagrangian_storage;j++) {
Xi_position[j] = 0.0;}
3288 const unsigned &n_lagrangian,
3289 const unsigned &n_lagrangian_type,
3290 const unsigned &n_dim,
3291 const unsigned &n_position_type,
3292 const unsigned &initial_n_value)
3293 :
Node(time_stepper_pt_,n_dim,n_position_type,initial_n_value,false),
3297 const unsigned n_storage = n_dim*n_position_type;
3305 const unsigned n_lagrangian_storage = n_lagrangian*n_lagrangian_type;
3308 for(
unsigned j=0;j<n_lagrangian_storage;j++) {
Xi_position[j] = 0.0;}
3340 const unsigned long nlagrangian_storage_orig
3342 if (nlagrangian_storage!=nlagrangian_storage_orig)
3344 std::ostringstream error_stream;
3345 error_stream <<
"The allocated lagrangian storage " 3346 << nlagrangian_storage
3347 <<
" is not the same as the original Solid Node " 3348 << nlagrangian_storage_orig << std::endl;
3351 OOMPH_CURRENT_FUNCTION,
3352 OOMPH_EXCEPTION_LOCATION);
3356 for(
unsigned j=0;j<nlagrangian_storage;j++)
3375 dump_file << nlagrangian_storage
3376 <<
" # number of Lagrangian position variables" << std::endl;
3378 for(
unsigned j=0;j<nlagrangian_storage;j++)
3398 getline(restart_file,input_string,
'#');
3400 restart_file.ignore(80,
'\n');
3402 const unsigned long check_nlagrangian_storage=atoi(input_string.c_str());
3403 if(check_nlagrangian_storage!=nlagrangian_storage)
3405 std::ostringstream error_stream;
3406 error_stream <<
"The allocated Lagrangian storage " 3407 << nlagrangian_storage <<
3408 " is not the same as that in the input file" 3409 << check_nlagrangian_storage << std::endl;
3412 OOMPH_CURRENT_FUNCTION,
3413 OOMPH_EXCEPTION_LOCATION);
3418 for(
unsigned j=0;j<nlagrangian_storage;j++)
3421 getline(restart_file,input_string);
3453 const bool &preserve_existing_data)
3463 preserve_existing_data);
3474 double*
const ¶meter_pt)
3497 double lagn_position=0.0;
3501 for (
unsigned imaster=0;imaster<nmaster;imaster++)
3517 const unsigned &
i)
const 3527 double lagn_position=0.0;
3531 for (
unsigned imaster=0;imaster<nmaster;imaster++)
3570 std::stringstream conversion;
3571 conversion <<
" of Solid Node Position" << current_string;
3577 std::stringstream conversion;
3578 conversion <<
" of Data" << current_string;
3589 (std::map<unsigned,double*> &map_of_value_pt)
3598 #ifdef OOMPH_HAS_MPI 3611 const unsigned n_lagrangian_storage =
3615 const unsigned n_current_value = vector_of_values.size();
3623 vector_of_values.resize(n_current_value + n_lagrangian_storage+n_debug);
3626 unsigned index = n_current_value;
3629 vector_of_values[index++]=n_lagrangian_storage;
3636 for(
unsigned i=0;
i<n_lagrangian_storage;
i++)
3639 vector_of_values[index] = *data_pt;
3659 const unsigned n_lagrangian_storage =
3663 unsigned orig_n_lagrangian_storage=unsigned(vector_of_values[index++]);
3664 if (orig_n_lagrangian_storage!=n_lagrangian_storage)
3666 std::ostringstream error_stream;
3667 error_stream <<
"Non-matching number of values:\n" 3668 <<
"sent and local n_lagrangian_storage: " 3669 << orig_n_lagrangian_storage <<
" " 3670 << n_lagrangian_storage << std::endl;
3672 OOMPH_CURRENT_FUNCTION,
3673 OOMPH_EXCEPTION_LOCATION);
3681 for(
unsigned i=0;
i<n_lagrangian_storage;
i++)
3684 *data_pt = vector_of_values[index];
double * Xi_position
Storage for the Lagrangian positions.
double raw_value(const unsigned &i) const
Return the i-th value stored at the Node. This interface does NOT take the hanging status of the Node...
double value(const unsigned &i) const
Return i-th stored value. This function is not virtual so that it can be inlined. This means that if ...
void read_eqn_numbers_from_vector(const Vector< long > &vector_of_eqn_numbers, unsigned &index)
Read all equation numbers from the vector starting from index. On return the index will be set to the...
void dump(std::ostream &dump_file) const
Dump nodal positions (variable and fixed) and associated data to file for restart.
void clear_copied_pointers()
Clear the pointers to the copied data.
virtual void set_coordinates_on_boundary(const unsigned &b, const unsigned &k, const Vector< double > &boundary_zeta)
Set the vector of the k-th generalised boundary coordinates on mesh boundary b. Broken virtual interf...
bool Obsolete
Flag to indicate that the Node has become obsolete — usually during mesh refinement process...
virtual ~SolidNode()
Destructor that cleans up the additional memory allocated in SolidNodes.
void range_check(const unsigned &i) const
Check that the argument is within the range of stored data values.
double dposition_dt(const unsigned &i) const
Return the i-th component of nodal velocity: dx/dt, either directly or via hanging node representatio...
void add_value_pt_to_map(std::map< unsigned, double *> &map_of_value_pt)
Overload the function add_values_to_map so that it also adds the variable position data...
TimeStepper * Time_stepper_pt
Pointer to a Timestepper. The inclusion of a Timestepper pointer in the Data class, ensures that time-derivatives can be calculated and storage can be managed at the low (Data) level.
void delete_value_storage()
Delete all storage allocated by the Data object for values and equation numbers.
void remove_from_boundary(const unsigned &b)
Remove the node from the mesh boundary b.
unsigned long ncol() const
Return the number of columns of the matrix.
bool does_pointer_correspond_to_value(double *const ¶meter_pt)
Check whether the pointer parameter_pt addresses internal data values.
void constrain(const unsigned &i)
Constrain the i-th stored variable when making hanging data If the data is already pinned leave it al...
virtual void unconstrain_positions()
Unconstrain the positions when the node is made non-hanging Empty virtual function that is overloaded...
double lagrangian_position_gen(const unsigned &k, const unsigned &i) const
Return generalised lagrangian coordinate either directly or via hanging node representation.
double position_gen(const unsigned &k, const unsigned &i) const
Return generalised nodal coordinate either directly or via hanging node representation.
bool is_on_boundary() const
Test whether the node lies on a boundary.
HangInfo *const & hanging_pt() const
Return pointer to hanging node data (this refers to the geometric hanging node status) (const version...
Vector< double > position() const
Return vector of position of node at current time.
void set_nonhanging()
Label node as non-hanging node by removing all hanging node data.
long * eqn_number_pt(const unsigned &i)
Return the pointer to the equation number of the i-th stored variable.
void add_to_boundary(const unsigned &b)
Add the node to the mesh boundary b.
double * value_pt(const unsigned &i) const
Return the pointer to the i-the stored value. Typically this is required when direct access to the st...
unsigned Nvalue
Number of values stored in the data object.
virtual void make_periodic(Node *const &node_pt)
Make the node periodic by copying the values from node_pt. Note that the coordinates will always rema...
int Non_halo_proc_ID
Non-halo processor ID for Data; -1 if it's not a halo.
virtual ~BoundaryNodeBase()
Destructor, clean up any allocated storage for the boundaries.
virtual void constrain_positions()
Constrain the positions when the node is made hanging Empty virtual function that is overloaded in So...
virtual void add_value_pt_to_map(std::map< unsigned, double *> &map_of_value_pt)
Add pointers to all unpinned and unconstrained data to a map indexed by (global) equation number...
void describe_dofs(std::ostream &out, const std::string ¤t_string) const
Function to describe the dofs of the Node. The ostream specifies the output stream to which the descr...
Node()
Default constructor.
void read_values_from_vector(const Vector< double > &vector_of_values, unsigned &index)
Read all data and time history values from the vector starting from index. On return the index will b...
Data * Variable_position_pt
Pointer to data that will hold variable positions in elastic nodes.
bool does_pointer_correspond_to_position_data(double *const ¶meter_pt)
Overload the check whether the pointer parameter_pt addresses position data values.
static TimeStepper * Default_static_time_stepper_pt
Default (static) timestepper used in steady problems.
void xi_gen_range_check(const unsigned &k, const unsigned &i) const
Private function to check that the arguments to the position functions are in range.
TimeStepper *& position_time_stepper_pt()
Return a pointer to the position timestepper.
double const & master_weight(const unsigned &i) const
Return weight for dofs on i-th master node.
Nodes are derived from Data, but, in addition, have a definite (Eulerian) position in a space of a gi...
void add_values_to_vector(Vector< double > &vector_of_values)
Add all data and time history values to the vector. Overloaded to add the position information as wel...
unsigned nmaster() const
Return the number of master nodes.
unsigned self_test()
Self-test: Have all values been classified as pinned/unpinned? Return 0 if OK.
static long Is_constrained
Static "Magic number" used in place of the equation number to indicate that the value is constrained ...
void make_nodes_periodic(Node *const &node_pt, Vector< Node *> const &periodic_copies_pt)
Helper function that is used to turn BoundaryNodes into periodic boundary nodes by setting the data v...
bool is_hanging() const
Test whether the node is geometrically hanging.
long & eqn_number(const unsigned &i)
Return the equation number of the i-th stored variable.
unsigned nvalue() const
Return number of values stored in data object (incl pinned ones).
virtual void describe_dofs(std::ostream &out, const std::string ¤t_string) const
Function to describe the dofs of the Node. The ostream specifies the output stream to which the descr...
void set_master_node_pt(const unsigned &i, Node *const &master_node_pt, const double &weight)
Set the pointer to the i-th master node and its weight.
double dx_gen_dt(const unsigned &k, const unsigned &i) const
i-th component of time derivative (velocity) of the generalised position, dx(k,i)/dt. `Type': k; Coordinate direction: i.
AuxNodeUpdateFctPt Aux_node_update_fct_pt
Pointer to auxiliary update function – this can be used to update any nodal values following the upd...
virtual void get_coordinates_on_boundary(const unsigned &b, const unsigned &k, Vector< double > &boundary_zeta)
Return the vector of the k-th generalised boundary coordinates on mesh boundary b. Broken virtual interface provides run-time error checking.
virtual unsigned ncoordinates_on_boundary(const unsigned &b)
Get the number of boundary coordinates on mesh boundary b. Broken virtual interface provides run-time...
void read(std::ifstream &restart_file)
Read nodal positions (variable and fixed) and associated data from file for restart.
HijackedData(const unsigned &copied_value, Data *const &data_pt)
Constructor.
void clear_copied_pointers()
Clear the pointers to the copied data.
Vector< double > value() const
Return vector of values calculated using value(vector).
unsigned ndim() const
Return (Eulerian) spatial dimension of the node.
void get_coordinates_on_boundary(const unsigned &b, Vector< double > &boundary_zeta)
Return the vector of boundary coordinates on mesh boundary b.
virtual void remove_from_boundary(const unsigned &b)
Broken interface for removing the node from the mesh boundary b Here to provide error reporting...
double dx_dt(const unsigned &i) const
Return the i-th component of nodal velocity: dx/dt.
void assign_eqn_numbers(unsigned long &global_number, Vector< double *> &dof_pt)
Overload the assign equation numbers routine.
unsigned Nlagrangian_type
Number of types of Lagrangian coordinates used to interpolate the Lagrangian coordinates within the e...
double & x(const unsigned &i)
Return the i-th nodal coordinate.
double & xi(const unsigned &i)
Reference to i-th Lagrangian position.
A class that contains the information required by Nodes that are located on Mesh boundaries. A BoundaryNode of a particular type is obtained by combining a given Node with this class. By differentiating between Nodes and BoundaryNodes we avoid a lot of un-necessary storage in the bulk Nodes.
friend std::ostream & operator<<(std::ostream &out, const Data &d)
double & xi_gen(const unsigned &k, const unsigned &i)
Reference to the generalised Lagrangian position. `Type': k; 'Coordinate direction: i...
void add_values_to_vector(Vector< double > &vector_of_values)
Add all data, position and time history values to the vector Overload to add the Lagrangian coordinat...
void set_coordinates_on_boundary(const unsigned &b, const Vector< double > &boundary_zeta)
Set the vector of boundary coordinates on mesh boundary b.
void read(std::ifstream &restart_file)
Read nodal position and associated data from file for restart.
virtual void add_values_to_vector(Vector< double > &vector_of_values)
Add all data and time history values to the vector in the internal storage order. ...
unsigned Nposition_type
Number of coordinate types used in the mapping between local and global coordinates (e...
bool is_segregated_solve_pinned(const unsigned &i)
Test whether the i-th variable is temporaily pinned for a segregated solve.
unsigned Ncopies
Number of Data that contain copies of this Data object's values.
static long Is_pinned
Static "Magic number" used in place of the equation number to indicate that the value is pinned...
double ** Value
C-style array of pointers to data values and possible history values. The data must be ordered in suc...
void copy(SolidNode *orig_node_pt)
Copy nodal positions and associated data from specified node object.
void set_position_time_stepper(TimeStepper *const &position_time_stepper_pt, const bool &preserve_existing_data)
Set a new position timestepper be resizing the appropriate storage Overloaded from the basic implemen...
void add_copy(Data *const &data_pt)
Add the pointer data_pt to the array Copy_of_data_pt. This should be used whenever copies are made of...
long * Eqn_number
C-style array of pointers to the (global) equation numbers of the values.
void copy(Data *orig_data_pt)
Copy Data values from specified Data object.
void set_value(const unsigned &i, const double &value_)
Set the i-th stored data value to specified value. The only reason that we require an explicit set fu...
virtual void assign_eqn_numbers(unsigned long &global_ndof, Vector< double *> &dof_pt)
Assign global equation numbers; increment global number of unknowns, global_ndof; and add any new dof...
unsigned nposition_type() const
Number of coordinate types needed in the mapping between local and global coordinates.
void set_time_stepper(TimeStepper *const &time_stepper_pt, const bool &preserve_existing_data)
Set a new timestepper by resizing the appropriate storage. If already assigned the equation numbering...
void make_node_periodic(Node *const &node_pt, Node *const &original_node_pt)
Helper function that is used to turn BoundaryNodes into peridic boundary nodes by setting the data va...
static long Is_segregated_solve_pinned
Static "Magic number" used in place of the equation number to indicate that the value is pinned...
A class that represents a collection of data; each Data object may contain many different individual ...
void unconstrain(const unsigned &i)
Unconstrain the i-th stored variable when make the data nonhanging. Only unconstrain if it was actual...
virtual ~Node()
Destructor: Clean up the memory allocated for nodal position.
double & x_gen(const unsigned &k, const unsigned &i)
Reference to the generalised position x(k,i).
virtual void read_values_from_vector(const Vector< double > &vector_of_values, unsigned &index)
Read all data and time history values from the vector starting from index. On return the index will b...
Data *const & variable_position_pt() const
Pointer to variable_position data (const version)
void reset_copied_pointers()
Reset the pointers to the copied data.
void resize(const unsigned &n_value)
We cannot resize HijackedData, so the resize function throws a warning.
void read(std::ifstream &restart_file)
Read data object from a file.
double lagrangian_position(const unsigned &i) const
Return lagrangian coordinate either directly or via hanging node representation.
Node *const & master_node_pt(const unsigned &i) const
Return a pointer to the i-th master node.
bool is_constrained(const unsigned &i)
Test whether the i-th variable is constrained (1: true; 0: false).
HangInfo ** Hanging_pt
C-style array of pointers to hanging node info. It's set to NULL if the node isn't hanging...
unsigned nlagrangian_type() const
Number of types of Lagrangian coordinates used to interpolate the Lagrangian coordinates within the e...
virtual void assign_eqn_numbers(unsigned long &global_ndof, Vector< double *> &dof_pt)
Assign global equation numbers; increment global number of unknowns, global_ndof; and add any new dof...
void dump(std::ostream &dump_file) const
Dump the data object to a file.
Data ** Copy_of_data_pt
C-style array of any Data objects that contain copies of the current Data object's data values...
virtual void dump(std::ostream &dump_file) const
Dump nodal position and associated data to file for restart.
Class that contains data for hanging nodes.
unsigned ncoordinates_on_boundary(const unsigned &b)
Get the number of boundary coordinates on mesh boundary b.
unsigned ntstorage() const
Return the number of doubles required to represent history (one for steady)
virtual bool boundary_coordinates_have_been_set_up()
virtual void set_position_time_stepper(TimeStepper *const &position_time_stepper_pt, const bool &preserve_existing_data)
Set a new position timestepper be resizing the appropriate storage.
unsigned ntstorage() const
Return total number of doubles stored per value to record time history of each value (one for steady ...
void remove_copy(Data *const &data_pt)
Remove the pointer data_pt from the array Copy_of_data_pt. This should be used whenever copies of the...
void read_values_from_vector(const Vector< double > &vector_of_values, unsigned &index)
Read all data and time history values from the vector starting from index. On return the index will b...
void add_master_node_pt(Node *const &master_node_pt, const double &weight)
Add (pointer to) master node and corresponding weight to the internally stored (pointers to) master n...
void x_gen_range_check(const unsigned &t, const unsigned &k, const unsigned &i) const
Private function to check that the arguemnts to the position functions are in range.
void set_external_variable_position_pt(Data *const &data_pt)
Set the variable position data from an external data object.
void copy(Node *orig_node_pt)
Copy all nodal data from specified Node object.
void set_hanging_pt(HangInfo *const &hang_pt, const int &i)
Set the hanging data for the i-th value. (hang_pt=0 to make non-hanging)
A Class for nodes that deform elastically (i.e. position is an unknown in the problem). The idea is that the Eulerian positions are stored in a Data object and the Lagrangian coordinates are stored in addition. The pointer that addresses the Eulerian positions is set to the pointer to Value in the Data object. Hence, SolidNode uses knowledge of the internal structure of Data and must be a friend of the Data class. In order to allow a mesh to deform via an elastic-style equation in deforming-domain problems, the positions are stored separately from the values, so that elastic problems may be combined with any other type of problem.
unsigned Ndim
Eulerian dimension of the node.
SolidNode()
Default Constructor.
void resize(const unsigned &n_value)
Resize the number of equations.
virtual Node * copied_node_pt() const
Return pointer to copied node (null if the current node is not a copy – always the case here; it's o...
virtual void clear_copied_pointers()
Helper function that should be overloaded derived classes that contain copies of data. The function must unset (NULL out) the internal pointers to the copied data. This is used when destructing data to ensure that all pointers remain valid. The default implementation throws an error because Data cannot be a copy.
TimeStepper *& time_stepper_pt()
Return the pointer to the timestepper.
TimeStepper * Position_time_stepper_pt
Pointer to the timestepper associated with the position data.
std::string string(const unsigned &i)
Return the i-th string or "" if the relevant string hasn't been defined.
static long Is_unclassified
Static "Magic number" used in place of the equation number to denote a value that hasn't been classif...
bool is_pinned(const unsigned &i) const
Test whether the i-th variable is pinned (1: true; 0: false).
Node * Copied_node_pt
If the BoundaryNode is periodic, this pointer is set to the BoundaryNode whose data it shares...
CopiedData(Data *const &data_pt)
Constructor.
static unsigned No_independent_position
Static "Magic number" used to indicate that there is no independent position in a periodic node...
virtual void resize(const unsigned &n_value)
Change (increase) the number of values that may be stored.
void reset_copied_pointers()
Reset the pointers to the copied data.
unsigned Nlagrangian
Number of Lagrangian coordinates of the node.
virtual bool is_on_boundary() const
Test whether the Node lies on a boundary. The "bulk" Node cannot lie on a boundary, so return false. This will be overloaded by BoundaryNodes.
bool is_halo() const
Is this Data a halo?
void output(std::ostream &outfile)
Output nodal position.
bool is_steady() const
Flag to indicate if a timestepper has been made steady (possibly temporarily to switch off time-depen...
double dposition_gen_dt(const unsigned &k, const unsigned &i) const
i-th component of time derivative (velocity) of the generalised position, dx(k,i)/dt. `Type': k; Coordinate direction: i. This function uses the hanging node representation if necessary.
void range_check(const unsigned &t, const unsigned &i) const
Check that the arguments are within the range of the stored data values and timesteps.
unsigned nlagrangian() const
Return number of lagrangian coordinates.
virtual void add_to_boundary(const unsigned &b)
Broken interface for adding the node to the mesh boundary b Essentially here for error reporting...
Data()
Default: Just set pointer to (steady) timestepper. No storage for values is allocated.
virtual bool is_a_copy() const
Return a boolean to indicate whether the Data objact contains any copied values. A base Data object c...
Base class for time-stepping schemes. Timestepper provides an approximation of the temporal derivativ...
virtual double weight(const unsigned &i, const unsigned &j) const
Access function for j-th weight for the i-th derivative.
virtual void read_eqn_numbers_from_vector(const Vector< long > &vector_of_eqn_numbers, unsigned &index)
Read all equation numbers from the vector starting from index. On return the index will be set to the...
virtual void add_eqn_numbers_to_vector(Vector< long > &vector_of_eqn_numbers)
Add all equation numbers to the vector in the internal storage order.
virtual void make_periodic_nodes(const Vector< Node *> &periodic_nodes_pt)
Make the nodes passed in the vector periodic_nodes share the same data as this node.
double ** X_position
Array of pointers to the data holding the Eulerian positions. The storage format must be the same as ...
void add_eqn_numbers_to_vector(Vector< long > &vector_of_eqn_numbers)
Add all equation numbers to the vector in the internal storage order. Overload to add equation number...
virtual ~Data()
Destructor, deallocates memory assigned for data.
Data * Copied_data_pt
Pointer to the Data object from which the value is copied.
void resize(const unsigned &n_value)
We cannot resize CopiedData, so the resize function throws a warning.
virtual void reset_copied_pointers()
Helper function that should be overloaded in derived classes that can contain copies of Data...