libMesh
rb_data_deserialization.C
Go to the documentation of this file.
1 // rbOOmit: An implementation of the Certified Reduced Basis method.
2 // Copyright (C) 2009, 2010, 2015 David J. Knezevic
3 
4 // This file is part of rbOOmit.
5 
6 // rbOOmit is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
10 
11 // rbOOmit is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
15 
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 
20 #include "libmesh/libmesh_config.h"
21 #if defined(LIBMESH_HAVE_CAPNPROTO)
22 
23 //libMesh includes
24 #include "libmesh/rb_eim_evaluation.h"
25 #include "libmesh/string_to_enum.h"
26 #include "libmesh/elem.h"
27 #include "libmesh/mesh.h"
28 #include "libmesh/rb_data_deserialization.h"
29 #include "libmesh/transient_rb_theta_expansion.h"
30 #include "libmesh/transient_rb_evaluation.h"
31 #include "libmesh/rb_eim_evaluation.h"
32 #include "libmesh/rb_scm_evaluation.h"
33 
34 // Cap'n'Proto includes
35 #include "capnp/serialize.h"
36 
37 // C++ includes
38 #include <unistd.h>
39 #include <iostream>
40 #include <fstream>
41 #include <fcntl.h>
42 
43 namespace libMesh
44 {
45 
46 namespace
47 {
48 
53 template <typename T>
54 Number load_scalar_value(const T & value)
55 {
56 #ifdef LIBMESH_USE_COMPLEX_NUMBERS
57  return Number(value.getReal(), value.getImag());
58 #else
59  return value;
60 #endif
61 }
62 
63 }
64 
65 namespace RBDataDeserialization
66 {
67 
68 // ---- RBEvaluationDeserialization (BEGIN) ----
69 
71  :
72  _rb_eval(rb_eval)
73 {}
74 
76 {}
77 
78 void RBEvaluationDeserialization::read_from_file(const std::string & path,
79  bool read_error_bound_data)
80 {
81  LOG_SCOPE("read_from_file()", "RBEvaluationDeserialization");
82 
83  int fd = open(path.c_str(), O_RDONLY);
84  if (!fd)
85  libmesh_error_msg("Couldn't open the buffer file: " + path);
86 
87  // Turn off the limit to the amount of data we can read in
88  capnp::ReaderOptions reader_options;
89  reader_options.traversalLimitInWords = std::numeric_limits<uint64_t>::max();
90 
91  std::unique_ptr<capnp::StreamFdMessageReader> message;
92  libmesh_try
93  {
94  message = libmesh_make_unique<capnp::StreamFdMessageReader>(fd, reader_options);
95  }
96  libmesh_catch(...)
97  {
98  libmesh_error_msg("Failed to open capnp buffer");
99  }
100 
101 #ifndef LIBMESH_USE_COMPLEX_NUMBERS
102  RBData::RBEvaluationReal::Reader rb_eval_reader =
103  message->getRoot<RBData::RBEvaluationReal>();
104 #else
105  RBData::RBEvaluationComplex::Reader rb_eval_reader =
106  message->getRoot<RBData::RBEvaluationComplex>();
107 #endif
108 
109  load_rb_evaluation_data(_rb_eval, rb_eval_reader, read_error_bound_data);
110 
111  int error = close(fd);
112  if (error)
113  libmesh_error_msg("Error closing a read-only file descriptor: " + path);
114 }
115 
116 // ---- RBEvaluationDeserialization (END) ----
117 
118 
119 // ---- TransientRBEvaluationDeserialization (BEGIN) ----
120 
123  _trans_rb_eval(trans_rb_eval)
124 {}
125 
127 {}
128 
130  bool read_error_bound_data)
131 {
132  LOG_SCOPE("read_from_file()", "TransientRBEvaluationDeserialization");
133 
134  int fd = open(path.c_str(), O_RDONLY);
135  if (!fd)
136  libmesh_error_msg("Couldn't open the buffer file: " + path);
137 
138  // Turn off the limit to the amount of data we can read in
139  capnp::ReaderOptions reader_options;
140  reader_options.traversalLimitInWords = std::numeric_limits<uint64_t>::max();
141 
142  std::unique_ptr<capnp::StreamFdMessageReader> message;
143  libmesh_try
144  {
145  message = libmesh_make_unique<capnp::StreamFdMessageReader>(fd, reader_options);
146  }
147  libmesh_catch(...)
148  {
149  libmesh_error_msg("Failed to open capnp buffer");
150  }
151 
152 #ifndef LIBMESH_USE_COMPLEX_NUMBERS
153  RBData::TransientRBEvaluationReal::Reader trans_rb_eval_reader =
154  message->getRoot<RBData::TransientRBEvaluationReal>();
155  RBData::RBEvaluationReal::Reader rb_eval_reader =
156  trans_rb_eval_reader.getRbEvaluation();
157 #else
158  RBData::TransientRBEvaluationComplex::Reader trans_rb_eval_reader =
159  message->getRoot<RBData::TransientRBEvaluationComplex>();
160  RBData::RBEvaluationComplex::Reader rb_eval_reader =
161  trans_rb_eval_reader.getRbEvaluation();
162 #endif
163 
165  rb_eval_reader,
166  trans_rb_eval_reader,
167  read_error_bound_data);
168 
169  int error = close(fd);
170  if (error)
171  libmesh_error_msg("Error closing a read-only file descriptor: " + path);
172 }
173 
174 // ---- TransientRBEvaluationDeserialization (END) ----
175 
176 
177 // ---- RBEIMEvaluationDeserialization (BEGIN) ----
178 
181  _rb_eim_eval(rb_eim_eval)
182 {}
183 
185 {}
186 
188 {
189  LOG_SCOPE("read_from_file()", "RBEIMEvaluationDeserialization");
190 
191  int fd = open(path.c_str(), O_RDONLY);
192  if (!fd)
193  libmesh_error_msg("Couldn't open the buffer file: " + path);
194 
195  // Turn off the limit to the amount of data we can read in
196  capnp::ReaderOptions reader_options;
197  reader_options.traversalLimitInWords = std::numeric_limits<uint64_t>::max();
198 
199  std::unique_ptr<capnp::StreamFdMessageReader> message;
200  libmesh_try
201  {
202  message = libmesh_make_unique<capnp::StreamFdMessageReader>(fd, reader_options);
203  }
204  libmesh_catch(...)
205  {
206  libmesh_error_msg("Failed to open capnp buffer");
207  }
208 
209 #ifndef LIBMESH_USE_COMPLEX_NUMBERS
210  RBData::RBEIMEvaluationReal::Reader rb_eim_eval_reader =
211  message->getRoot<RBData::RBEIMEvaluationReal>();
212  RBData::RBEvaluationReal::Reader rb_eval_reader =
213  rb_eim_eval_reader.getRbEvaluation();
214 #else
215  RBData::RBEIMEvaluationComplex::Reader rb_eim_eval_reader =
216  message->getRoot<RBData::RBEIMEvaluationComplex>();
217  RBData::RBEvaluationComplex::Reader rb_eval_reader =
218  rb_eim_eval_reader.getRbEvaluation();
219 #endif
220 
222  rb_eval_reader,
223  rb_eim_eval_reader);
224 
225  int error = close(fd);
226  if (error)
227  libmesh_error_msg("Error closing a read-only file descriptor: " + path);
228 }
229 
230 // ---- RBEIMEvaluationDeserialization (END) ----
231 
232 
233 // ---- RBSCMEvaluationDeserialization (BEGIN) ----
234 // RBSCMEvaluationDeserialization is only available if both SLEPC and
235 // GLPK are available.
236 
237 #if defined(LIBMESH_HAVE_SLEPC) && (LIBMESH_HAVE_GLPK)
238 
241  _rb_scm_eval(rb_scm_eval)
242 {}
243 
245 {}
246 
248 {
249  LOG_SCOPE("read_from_file()", "RBSCMEvaluationDeserialization");
250 
251  int fd = open(path.c_str(), O_RDONLY);
252  if (!fd)
253  libmesh_error_msg("Couldn't open the buffer file: " + path);
254 
255  // Turn off the limit to the amount of data we can read in
256  capnp::ReaderOptions reader_options;
257  reader_options.traversalLimitInWords = std::numeric_limits<uint64_t>::max();
258 
259  std::unique_ptr<capnp::StreamFdMessageReader> message;
260  libmesh_try
261  {
262  message = libmesh_make_unique<capnp::StreamFdMessageReader>(fd, reader_options);
263  }
264  libmesh_catch(...)
265  {
266  libmesh_error_msg("Failed to open capnp buffer");
267  }
268 
269  RBData::RBSCMEvaluation::Reader rb_scm_eval_reader =
270  message->getRoot<RBData::RBSCMEvaluation>();
271 
273  rb_scm_eval_reader);
274 
275  int error = close(fd);
276  if (error)
277  libmesh_error_msg("Error closing a read-only file descriptor: " + path);
278 }
279 
280 #endif // LIBMESH_HAVE_SLEPC && LIBMESH_HAVE_GLPK
281 
282 // ---- RBSCMEvaluationDeserialization (END) ----
283 
284 
285 // ---- Helper functions for loading data from buffers (BEGIN) ----
286 
288  RBData::ParameterRanges::Reader & parameter_ranges,
289  RBData::DiscreteParameterList::Reader & discrete_parameters_list)
290 {
291  // Continuous parameters
292  RBParameters parameters_min;
293  RBParameters parameters_max;
294  {
295  unsigned int n_parameter_ranges = parameter_ranges.getNames().size();
296 
297  for (unsigned int i=0; i<n_parameter_ranges; ++i)
298  {
299  std::string parameter_name = parameter_ranges.getNames()[i];
300  Real min_value = parameter_ranges.getMinValues()[i];
301  Real max_value = parameter_ranges.getMaxValues()[i];
302 
303  parameters_min.set_value(parameter_name, min_value);
304  parameters_max.set_value(parameter_name, max_value);
305  }
306  }
307 
308  // Discrete parameters
309  std::map<std::string, std::vector<Real>> discrete_parameter_values;
310  {
311  unsigned int n_discrete_parameters = discrete_parameters_list.getNames().size();
312 
313  for (unsigned int i=0; i<n_discrete_parameters; ++i)
314  {
315  std::string parameter_name = discrete_parameters_list.getNames()[i];
316 
317  auto value_list = discrete_parameters_list.getValues()[i];
318  unsigned int n_values = value_list.size();
319  std::vector<Real> values(n_values);
320  for (unsigned int j=0; j<n_values; ++j)
321  values[j] = value_list[j];
322 
323  discrete_parameter_values[parameter_name] = values;
324  }
325  }
326 
327  rb_evaluation.initialize_parameters(parameters_min,
328  parameters_max,
329  discrete_parameter_values);
330 }
331 
332 template <typename RBEvaluationReaderNumber>
334  RBEvaluationReaderNumber & rb_evaluation_reader,
335  bool read_error_bound_data)
336 {
337  // Set number of basis functions
338  unsigned int n_bfs = rb_evaluation_reader.getNBfs();
339  rb_evaluation.set_n_basis_functions(n_bfs);
340 
341  rb_evaluation.resize_data_structures(n_bfs, read_error_bound_data);
342 
343  auto parameter_ranges =
344  rb_evaluation_reader.getParameterRanges();
345  auto discrete_parameters_list =
346  rb_evaluation_reader.getDiscreteParameters();
347 
348  load_parameter_ranges(rb_evaluation,
349  parameter_ranges,
350  discrete_parameters_list);
351 
352  const RBThetaExpansion & rb_theta_expansion = rb_evaluation.get_rb_theta_expansion();
353 
354  unsigned int n_F_terms = rb_theta_expansion.get_n_F_terms();
355  unsigned int n_A_terms = rb_theta_expansion.get_n_A_terms();
356 
357  if (read_error_bound_data)
358  {
359 
360  // Fq representor inner-product data
361  {
362  unsigned int Q_f_hat = n_F_terms*(n_F_terms+1)/2;
363 
364  auto fq_innerprods_list = rb_evaluation_reader.getFqInnerprods();
365  if (fq_innerprods_list.size() != Q_f_hat)
366  libmesh_error_msg("Size error while reading Fq representor norm data from buffer.");
367 
368  for (unsigned int i=0; i < Q_f_hat; ++i)
369  rb_evaluation.Fq_representor_innerprods[i] = load_scalar_value(fq_innerprods_list[i]);
370  }
371 
372  // Fq_Aq representor inner-product data
373  {
374  auto fq_aq_innerprods_list = rb_evaluation_reader.getFqAqInnerprods();
375  if (fq_aq_innerprods_list.size() != n_F_terms*n_A_terms*n_bfs)
376  libmesh_error_msg("Size error while reading Fq-Aq representor norm data from buffer.");
377 
378  for (unsigned int q_f=0; q_f<n_F_terms; ++q_f)
379  for (unsigned int q_a=0; q_a<n_A_terms; ++q_a)
380  for (unsigned int i=0; i<n_bfs; ++i)
381  {
382  unsigned int offset = q_f*n_A_terms*n_bfs + q_a*n_bfs + i;
383  rb_evaluation.Fq_Aq_representor_innerprods[q_f][q_a][i] =
384  load_scalar_value(fq_aq_innerprods_list[offset]);
385  }
386  }
387 
388  // Aq_Aq representor inner-product data
389  {
390  unsigned int Q_a_hat = n_A_terms*(n_A_terms+1)/2;
391  auto aq_aq_innerprods_list = rb_evaluation_reader.getAqAqInnerprods();
392  if (aq_aq_innerprods_list.size() != Q_a_hat*n_bfs*n_bfs)
393  libmesh_error_msg("Size error while reading Aq-Aq representor norm data from buffer.");
394 
395  for (unsigned int i=0; i<Q_a_hat; ++i)
396  for (unsigned int j=0; j<n_bfs; ++j)
397  for (unsigned int l=0; l<n_bfs; ++l)
398  {
399  unsigned int offset = i*n_bfs*n_bfs + j*n_bfs + l;
400  rb_evaluation.Aq_Aq_representor_innerprods[i][j][l] =
401  load_scalar_value(aq_aq_innerprods_list[offset]);
402  }
403  }
404 
405  // Output dual inner-product data
406  {
407  unsigned int n_outputs = rb_theta_expansion.get_n_outputs();
408  auto output_innerprod_outer = rb_evaluation_reader.getOutputDualInnerprods();
409 
410  if (output_innerprod_outer.size() != n_outputs)
411  libmesh_error_msg("Incorrect number of outputs detected in the buffer");
412 
413  for (unsigned int output_id=0; output_id<n_outputs; ++output_id)
414  {
415  unsigned int n_output_terms = rb_theta_expansion.get_n_output_terms(output_id);
416 
417  unsigned int Q_l_hat = n_output_terms*(n_output_terms+1)/2;
418  auto output_innerprod_inner = output_innerprod_outer[output_id];
419 
420  if (output_innerprod_inner.size() != Q_l_hat)
421  libmesh_error_msg("Incorrect number of output terms detected in the buffer");
422 
423  for (unsigned int q=0; q<Q_l_hat; ++q)
424  {
425  rb_evaluation.output_dual_innerprods[output_id][q] =
426  load_scalar_value(output_innerprod_inner[q]);
427  }
428  }
429  }
430  }
431 
432  // Output vectors
433  {
434  unsigned int n_outputs = rb_theta_expansion.get_n_outputs();
435  auto output_vector_outer = rb_evaluation_reader.getOutputVectors();
436 
437  if (output_vector_outer.size() != n_outputs)
438  libmesh_error_msg("Incorrect number of outputs detected in the buffer");
439 
440  for (unsigned int output_id=0; output_id<n_outputs; ++output_id)
441  {
442  unsigned int n_output_terms = rb_theta_expansion.get_n_output_terms(output_id);
443 
444  auto output_vector_middle = output_vector_outer[output_id];
445  if (output_vector_middle.size() != n_output_terms)
446  libmesh_error_msg("Incorrect number of output terms detected in the buffer");
447 
448  for (unsigned int q_l=0; q_l<n_output_terms; ++q_l)
449  {
450  auto output_vectors_inner_list = output_vector_middle[q_l];
451 
452  if (output_vectors_inner_list.size() != n_bfs)
453  libmesh_error_msg("Incorrect number of output terms detected in the buffer");
454 
455  for (unsigned int j=0; j<n_bfs; ++j)
456  {
457  rb_evaluation.RB_output_vectors[output_id][q_l](j) =
458  load_scalar_value(output_vectors_inner_list[j]);
459  }
460  }
461  }
462  }
463 
464  // Fq vectors and Aq matrices
465  {
466  auto rb_fq_vectors_outer_list = rb_evaluation_reader.getRbFqVectors();
467  if (rb_fq_vectors_outer_list.size() != n_F_terms)
468  libmesh_error_msg("Incorrect number of Fq vectors detected in the buffer");
469 
470  for (unsigned int q_f=0; q_f<n_F_terms; ++q_f)
471  {
472  auto rb_fq_vectors_inner_list = rb_fq_vectors_outer_list[q_f];
473  if (rb_fq_vectors_inner_list.size() != n_bfs)
474  libmesh_error_msg("Incorrect Fq vector size detected in the buffer");
475 
476  for (unsigned int i=0; i < n_bfs; ++i)
477  {
478  rb_evaluation.RB_Fq_vector[q_f](i) =
479  load_scalar_value(rb_fq_vectors_inner_list[i]);
480  }
481  }
482 
483  auto rb_Aq_matrices_outer_list = rb_evaluation_reader.getRbAqMatrices();
484  if (rb_Aq_matrices_outer_list.size() != n_A_terms)
485  libmesh_error_msg("Incorrect number of Aq matrices detected in the buffer");
486 
487  for (unsigned int q_a=0; q_a<n_A_terms; ++q_a)
488  {
489  auto rb_Aq_matrices_inner_list = rb_Aq_matrices_outer_list[q_a];
490  if (rb_Aq_matrices_inner_list.size() != n_bfs*n_bfs)
491  libmesh_error_msg("Incorrect Aq matrix size detected in the buffer");
492 
493  for (unsigned int i=0; i<n_bfs; ++i)
494  for (unsigned int j=0; j<n_bfs; ++j)
495  {
496  unsigned int offset = i*n_bfs+j;
497  rb_evaluation.RB_Aq_vector[q_a](i,j) =
498  load_scalar_value(rb_Aq_matrices_inner_list[offset]);
499  }
500  }
501  }
502 
503  // Inner-product matrix
504  if (rb_evaluation.compute_RB_inner_product)
505  {
506  auto rb_inner_product_matrix_list =
507  rb_evaluation_reader.getRbInnerProductMatrix();
508 
509  if (rb_inner_product_matrix_list.size() != n_bfs*n_bfs)
510  libmesh_error_msg("Size error while reading the inner product matrix.");
511 
512  for (unsigned int i=0; i<n_bfs; ++i)
513  for (unsigned int j=0; j<n_bfs; ++j)
514  {
515  unsigned int offset = i*n_bfs + j;
516  rb_evaluation.RB_inner_product_matrix(i,j) =
517  load_scalar_value(rb_inner_product_matrix_list[offset]);
518  }
519  }
520 }
521 
522 template <typename RBEvaluationReaderNumber, typename TransRBEvaluationReaderNumber>
524  RBEvaluationReaderNumber & rb_eval_reader,
525  TransRBEvaluationReaderNumber & trans_rb_eval_reader,
526  bool read_error_bound_data)
527 {
528  load_rb_evaluation_data(trans_rb_eval,
529  rb_eval_reader,
530  read_error_bound_data);
531 
532  trans_rb_eval.set_delta_t( trans_rb_eval_reader.getDeltaT() );
533  trans_rb_eval.set_euler_theta( trans_rb_eval_reader.getEulerTheta() );
534  trans_rb_eval.set_n_time_steps( trans_rb_eval_reader.getNTimeSteps() );
535  trans_rb_eval.set_time_step( trans_rb_eval_reader.getTimeStep() );
536 
537  unsigned int n_bfs = rb_eval_reader.getNBfs();
538  unsigned int n_F_terms = trans_rb_eval.get_rb_theta_expansion().get_n_F_terms();
539  unsigned int n_A_terms = trans_rb_eval.get_rb_theta_expansion().get_n_A_terms();
540 
541  TransientRBThetaExpansion & trans_theta_expansion =
542  cast_ref<TransientRBThetaExpansion &>(trans_rb_eval.get_rb_theta_expansion());
543  unsigned int n_M_terms = trans_theta_expansion.get_n_M_terms();
544 
545  // L2 matrix
546  {
547  auto rb_L2_matrix_list =
548  trans_rb_eval_reader.getRbL2Matrix();
549 
550  if (rb_L2_matrix_list.size() != n_bfs*n_bfs)
551  libmesh_error_msg("Size error while reading the L2 matrix.");
552 
553  for (unsigned int i=0; i<n_bfs; ++i)
554  for (unsigned int j=0; j<n_bfs; ++j)
555  {
556  unsigned int offset = i*n_bfs + j;
557  trans_rb_eval.RB_L2_matrix(i,j) =
558  load_scalar_value(rb_L2_matrix_list[offset]);
559  }
560  }
561 
562  // Mq matrices
563  {
564  auto rb_Mq_matrices_outer_list = trans_rb_eval_reader.getRbMqMatrices();
565 
566  if (rb_Mq_matrices_outer_list.size() != n_M_terms)
567  libmesh_error_msg("Incorrect number of Mq matrices detected in the buffer");
568 
569  for (unsigned int q_m=0; q_m < n_M_terms; ++q_m)
570  {
571  auto rb_Mq_matrices_inner_list = rb_Mq_matrices_outer_list[q_m];
572  if (rb_Mq_matrices_inner_list.size() != n_bfs*n_bfs)
573  libmesh_error_msg("Incorrect Mq matrix size detected in the buffer");
574 
575  for (unsigned int i=0; i<n_bfs; ++i)
576  for (unsigned int j=0; j<n_bfs; ++j)
577  {
578  unsigned int offset = i*n_bfs+j;
579  trans_rb_eval.RB_M_q_vector[q_m](i,j) =
580  load_scalar_value(rb_Mq_matrices_inner_list[offset]);
581  }
582  }
583  }
584 
585  // The initial condition and L2 error at t=0.
586  {
587  auto initial_l2_errors_reader =
588  trans_rb_eval_reader.getInitialL2Errors();
589  if (initial_l2_errors_reader.size() != n_bfs)
590  libmesh_error_msg("Incorrect number of initial L2 error terms detected in the buffer");
591 
592  auto initial_conditions_outer_list =
593  trans_rb_eval_reader.getInitialConditions();
594  if (initial_conditions_outer_list.size() != n_bfs)
595  libmesh_error_msg("Incorrect number of outer initial conditions detected in the buffer");
596 
597  for (unsigned int i=0; i<n_bfs; i++)
598  {
599  trans_rb_eval.initial_L2_error_all_N[i] =
600  initial_l2_errors_reader[i];
601 
602  auto initial_conditions_inner_list = initial_conditions_outer_list[i];
603  if (initial_conditions_inner_list.size() != (i+1))
604  libmesh_error_msg("Incorrect number of inner initial conditions detected in the buffer");
605 
606  for (unsigned int j=0; j<=i; j++)
607  {
608  trans_rb_eval.RB_initial_condition_all_N[i](j) =
609  load_scalar_value(initial_conditions_inner_list[j]);
610  }
611  }
612  }
613 
614 
615  if (read_error_bound_data)
616  {
617  // Fq_Mq data
618  {
619  auto fq_mq_innerprods_list = trans_rb_eval_reader.getFqMqInnerprods();
620  if (fq_mq_innerprods_list.size() != n_F_terms*n_M_terms*n_bfs)
621  libmesh_error_msg("Size error while reading Fq-Mq representor data from buffer.");
622 
623  for (unsigned int q_f=0; q_f<n_F_terms; ++q_f)
624  for (unsigned int q_m=0; q_m<n_M_terms; ++q_m)
625  for (unsigned int i=0; i<n_bfs; ++i)
626  {
627  unsigned int offset = q_f*n_M_terms*n_bfs + q_m*n_bfs + i;
628  trans_rb_eval.Fq_Mq_representor_innerprods[q_f][q_m][i] =
629  load_scalar_value(fq_mq_innerprods_list[offset]);
630  }
631  }
632 
633 
634  // Mq_Mq representor inner-product data
635  {
636  unsigned int Q_m_hat = n_M_terms*(n_M_terms+1)/2;
637  auto mq_mq_innerprods_list = trans_rb_eval_reader.getMqMqInnerprods();
638  if (mq_mq_innerprods_list.size() != Q_m_hat*n_bfs*n_bfs)
639  libmesh_error_msg("Size error while reading Mq-Mq representor data from buffer.");
640 
641  for (unsigned int i=0; i<Q_m_hat; ++i)
642  for (unsigned int j=0; j<n_bfs; ++j)
643  for (unsigned int l=0; l<n_bfs; ++l)
644  {
645  unsigned int offset = i*n_bfs*n_bfs + j*n_bfs + l;
646  trans_rb_eval.Mq_Mq_representor_innerprods[i][j][l] =
647  load_scalar_value(mq_mq_innerprods_list[offset]);
648  }
649  }
650 
651  // Aq_Mq representor inner-product data
652  {
653  auto aq_mq_innerprods_list =
654  trans_rb_eval_reader.getAqMqInnerprods();
655  if (aq_mq_innerprods_list.size() != n_A_terms*n_M_terms*n_bfs*n_bfs)
656  libmesh_error_msg("Size error while reading Aq-Mq representor data from buffer.");
657 
658  for (unsigned int q_a=0; q_a<n_A_terms; q_a++)
659  for (unsigned int q_m=0; q_m<n_M_terms; q_m++)
660  for (unsigned int i=0; i<n_bfs; i++)
661  for (unsigned int j=0; j<n_bfs; j++)
662  {
663  unsigned int offset =
664  q_a*(n_M_terms*n_bfs*n_bfs) + q_m*(n_bfs*n_bfs) + i*n_bfs + j;
665 
666  trans_rb_eval.Aq_Mq_representor_innerprods[q_a][q_m][i][j] =
667  load_scalar_value(aq_mq_innerprods_list[offset]);
668  }
669  }
670 
671  }
672 }
673 
674 template <typename RBEvaluationReaderNumber, typename RBEIMEvaluationReaderNumber>
676  RBEvaluationReaderNumber & rb_evaluation_reader,
677  RBEIMEvaluationReaderNumber & rb_eim_evaluation_reader)
678 {
679  // We use read_error_bound_data=false here, since the RBEvaluation error bound data
680  // is not relevant to EIM.
681  load_rb_evaluation_data(rb_eim_evaluation,
682  rb_evaluation_reader,
683  /*read_error_bound_data*/ false);
684 
685  unsigned int n_bfs = rb_eim_evaluation.get_n_basis_functions();
686 
687  // EIM interpolation matrix
688  {
689  auto interpolation_matrix_list = rb_eim_evaluation_reader.getInterpolationMatrix();
690 
691  if (interpolation_matrix_list.size() != n_bfs*(n_bfs+1)/2)
692  libmesh_error_msg("Size error while reading the eim inner product matrix.");
693 
694  for (unsigned int i=0; i<n_bfs; ++i)
695  for (unsigned int j=0; j<=i; ++j)
696  {
697  unsigned int offset = i*(i+1)/2 + j;
698  rb_eim_evaluation.interpolation_matrix(i,j) =
699  load_scalar_value(interpolation_matrix_list[offset]);
700  }
701  }
702 
703  // Interpolation points
704  {
705  auto interpolation_points_list =
706  rb_eim_evaluation_reader.getInterpolationPoints();
707 
708  if (interpolation_points_list.size() != n_bfs)
709  libmesh_error_msg("Size error while reading the eim interpolation points.");
710 
711  rb_eim_evaluation.interpolation_points.resize(n_bfs);
712  for (unsigned int i=0; i<n_bfs; ++i)
713  {
714  load_point(interpolation_points_list[i],
715  rb_eim_evaluation.interpolation_points[i]);
716  }
717  }
718 
719  // Interpolation points variables
720  {
721  auto interpolation_points_var_list =
722  rb_eim_evaluation_reader.getInterpolationPointsVar();
723  rb_eim_evaluation.interpolation_points_var.resize(n_bfs);
724 
725  if (interpolation_points_var_list.size() != n_bfs)
726  libmesh_error_msg("Size error while reading the eim interpolation variables.");
727 
728  for (unsigned int i=0; i<n_bfs; ++i)
729  {
730  rb_eim_evaluation.interpolation_points_var[i] =
731  interpolation_points_var_list[i];
732  }
733  }
734 
735  // Interpolation elements
736  {
737  libMesh::dof_id_type elem_id = 0;
738  libMesh::ReplicatedMesh & interpolation_points_mesh =
739  rb_eim_evaluation.get_interpolation_points_mesh();
740  interpolation_points_mesh.clear();
741 
742  auto interpolation_points_elem_list =
743  rb_eim_evaluation_reader.getInterpolationPointsElems();
744  unsigned int n_interpolation_elems = interpolation_points_elem_list.size();
745 
746  if (n_interpolation_elems != n_bfs)
747  libmesh_error_msg("The number of elements should match the number of basis functions");
748 
749  rb_eim_evaluation.interpolation_points_elem.resize(n_interpolation_elems);
750 
751  for (unsigned int i=0; i<n_interpolation_elems; ++i)
752  {
753  auto mesh_elem_reader = interpolation_points_elem_list[i];
754  std::string elem_type_name = mesh_elem_reader.getType().cStr();
755  libMesh::ElemType elem_type =
756  libMesh::Utility::string_to_enum<libMesh::ElemType>(elem_type_name);
757 
758  libMesh::Elem * elem = libMesh::Elem::build(elem_type).release();
759  elem->set_id(elem_id++);
760  load_elem_into_mesh(mesh_elem_reader, elem, interpolation_points_mesh);
761 
762  rb_eim_evaluation.interpolation_points_elem[i] = elem;
763  }
764  }
765 }
766 
767 #if defined(LIBMESH_HAVE_SLEPC) && (LIBMESH_HAVE_GLPK)
769  RBData::RBSCMEvaluation::Reader & rb_scm_evaluation_reader)
770 {
771  auto parameter_ranges =
772  rb_scm_evaluation_reader.getParameterRanges();
773  auto discrete_parameters_list =
774  rb_scm_evaluation_reader.getDiscreteParameters();
775  load_parameter_ranges(rb_scm_eval,
776  parameter_ranges,
777  discrete_parameters_list);
778 
779  unsigned int n_A_terms = rb_scm_eval.get_rb_theta_expansion().get_n_A_terms();
780 
781  {
782  auto b_min_list = rb_scm_evaluation_reader.getBMin();
783 
784  if (b_min_list.size() != n_A_terms)
785  libmesh_error_msg("Size error while reading B_min");
786 
787  rb_scm_eval.B_min.clear();
788  for (unsigned int i=0; i<n_A_terms; i++)
789  rb_scm_eval.B_min.push_back(b_min_list[i]);
790  }
791 
792  {
793  auto b_max_list = rb_scm_evaluation_reader.getBMax();
794 
795  if (b_max_list.size() != n_A_terms)
796  libmesh_error_msg("Size error while reading B_max");
797 
798  rb_scm_eval.B_max.clear();
799  for (unsigned int i=0; i<n_A_terms; i++)
800  rb_scm_eval.B_max.push_back(b_max_list[i]);
801  }
802 
803  {
804  auto cJ_stability_vector =
805  rb_scm_evaluation_reader.getCJStabilityVector();
806 
807  rb_scm_eval.C_J_stability_vector.clear();
808  for (const auto & val : cJ_stability_vector)
809  rb_scm_eval.C_J_stability_vector.push_back(val);
810  }
811 
812  {
813  auto cJ_parameters_outer =
814  rb_scm_evaluation_reader.getCJ();
815 
816  rb_scm_eval.C_J.resize(cJ_parameters_outer.size());
817  for (auto i : index_range(cJ_parameters_outer))
818  {
819  auto cJ_parameters_inner =
820  cJ_parameters_outer[i];
821 
822  for (auto j : index_range(cJ_parameters_inner))
823  {
824  std::string param_name = cJ_parameters_inner[j].getName();
825  Real param_value = cJ_parameters_inner[j].getValue();
826  rb_scm_eval.C_J[i].set_value(param_name, param_value);
827  }
828  }
829  }
830 
831  {
832  auto scm_ub_vectors =
833  rb_scm_evaluation_reader.getScmUbVectors();
834 
835  // The number of UB vectors is the same as the number of C_J values
836  unsigned int n_C_J_values = rb_scm_evaluation_reader.getCJ().size();
837 
838  if (scm_ub_vectors.size() != n_C_J_values*n_A_terms)
839  libmesh_error_msg("Size mismatch in SCB UB vectors");
840 
841  rb_scm_eval.SCM_UB_vectors.resize( n_C_J_values );
842  for (unsigned int i=0; i<n_C_J_values; i++)
843  {
844  rb_scm_eval.SCM_UB_vectors[i].resize(n_A_terms);
845  for (unsigned int j=0; j<n_A_terms; j++)
846  {
847  unsigned int offset = i*n_A_terms + j;
848  rb_scm_eval.SCM_UB_vectors[i][j] = scm_ub_vectors[offset];
849 
850  }
851  }
852  }
853 
854 }
855 #endif // LIBMESH_HAVE_SLEPC && LIBMESH_HAVE_GLPK
856 
857 
858 
859 void load_point(RBData::Point3D::Reader point_reader, Point & point)
860 {
861  point(0) = point_reader.getX();
862 
863  if (LIBMESH_DIM >= 2)
864  point(1) = point_reader.getY();
865 
866  if (LIBMESH_DIM >= 3)
867  point(2) = point_reader.getZ();
868 }
869 
870 
871 void load_elem_into_mesh(RBData::MeshElem::Reader mesh_elem_reader,
872  libMesh::Elem * elem,
874 {
875  auto mesh_elem_point_list = mesh_elem_reader.getPoints();
876  unsigned int n_points = mesh_elem_point_list.size();
877 
878  if (n_points != elem->n_nodes())
879  libmesh_error_msg("Wrong number of nodes for element type");
880 
881  for (unsigned int i=0; i < n_points; ++i)
882  {
883  libMesh::Node * node = new libMesh::Node(mesh_elem_point_list[i].getX(),
884  mesh_elem_point_list[i].getY(),
885  mesh_elem_point_list[i].getZ());
886 
887  mesh.add_node(node);
888 
889  elem->set_node(i) = node;
890  }
891 
892  elem->subdomain_id() = mesh_elem_reader.getSubdomainId();
893 
894  mesh.add_elem(elem);
895 }
896 
897 // ---- Helper functions for adding data to capnp Builders (END) ----
898 
899 } // namespace RBDataSerialization
900 
901 } // namespace libMesh
902 
903 #endif // #if defined(LIBMESH_HAVE_CAPNPROTO)
libMesh::RBEvaluation::get_n_basis_functions
virtual unsigned int get_n_basis_functions() const
Get the current number of basis functions.
Definition: rb_evaluation.h:145
libMesh::RBDataDeserialization::load_rb_eim_evaluation_data
void load_rb_eim_evaluation_data(RBEIMEvaluation &rb_eim_eval, RBEvaluationReaderNumber &rb_evaluation_reader, RBEIMEvaluationReaderNumber &rb_eim_eval_reader)
Load an EIM RB evaluation from a corresponding reader structure in the buffer.
Definition: rb_data_deserialization.C:675
libMesh::RBDataDeserialization::TransientRBEvaluationDeserialization::_trans_rb_eval
TransientRBEvaluation & _trans_rb_eval
The TransientRBEvaluation object that we will read into.
Definition: rb_data_deserialization.h:118
libMesh::dof_id_type
uint8_t dof_id_type
Definition: id_types.h:67
libMesh::Number
Real Number
Definition: libmesh_common.h:195
libMesh::RBEvaluation::RB_Aq_vector
std::vector< DenseMatrix< Number > > RB_Aq_vector
Dense matrices for the RB computations.
Definition: rb_evaluation.h:260
libMesh::RBThetaExpansion::get_n_output_terms
unsigned int get_n_output_terms(unsigned int output_index) const
Get the number of affine terms associated with the specified output.
Definition: rb_theta_expansion.C:53
libMesh::RBDataDeserialization::RBEvaluationDeserialization::~RBEvaluationDeserialization
virtual ~RBEvaluationDeserialization()
Destructor.
Definition: rb_data_deserialization.C:75
libMesh::RBThetaExpansion::get_n_F_terms
unsigned int get_n_F_terms() const
Get Q_f, the number of terms in the affine expansion for the right-hand side.
Definition: rb_theta_expansion.C:41
libMesh::RBEvaluation::set_n_basis_functions
virtual void set_n_basis_functions(unsigned int n_bfs)
Set the number of basis functions.
Definition: rb_evaluation.C:78
libMesh::RBDataDeserialization::RBSCMEvaluationDeserialization::~RBSCMEvaluationDeserialization
virtual ~RBSCMEvaluationDeserialization()
Destructor.
Definition: rb_data_deserialization.C:244
libMesh::RBTemporalDiscretization::set_n_time_steps
void set_n_time_steps(const unsigned int K)
Definition: rb_temporal_discretization.C:73
libMesh::RBSCMEvaluation::C_J
std::vector< RBParameters > C_J
Vector storing the greedily selected parameters during SCM training.
Definition: rb_scm_evaluation.h:192
libMesh::TransientRBThetaExpansion
This class stores the set of RBTheta functor objects that define the "parameter-dependent expansion" ...
Definition: transient_rb_theta_expansion.h:41
libMesh::RBDataDeserialization::RBEIMEvaluationDeserialization::_rb_eim_eval
RBEIMEvaluation & _rb_eim_eval
The RBEIMEvaluation object we will read into.
Definition: rb_data_deserialization.h:151
libMesh::RBSCMEvaluation::B_max
std::vector< Real > B_max
Definition: rb_scm_evaluation.h:186
libMesh::Elem::n_nodes
virtual unsigned int n_nodes() const =0
libMesh::RBDataDeserialization::TransientRBEvaluationDeserialization::TransientRBEvaluationDeserialization
TransientRBEvaluationDeserialization(TransientRBEvaluation &trans_rb_eval)
Initialize a new buffer using the structure from the Cap'n'Proto schema described in rb_data....
Definition: rb_data_deserialization.C:122
libMesh::RBDataDeserialization::load_transient_rb_evaluation_data
void load_transient_rb_evaluation_data(TransientRBEvaluation &trans_rb_eval, RBEvaluationReaderNumber &rb_evaluation_reader, TransRBEvaluationReaderNumber &trans_rb_eval_reader, bool read_error_bound_data)
Load an RB evaluation from a corresponding reader structure in the buffer.
Definition: rb_data_deserialization.C:523
libMesh::RBDataDeserialization::TransientRBEvaluationDeserialization::~TransientRBEvaluationDeserialization
virtual ~TransientRBEvaluationDeserialization()
Destructor.
Definition: rb_data_deserialization.C:126
libMesh::RBTemporalDiscretization::set_delta_t
void set_delta_t(const Real delta_t_in)
Definition: rb_temporal_discretization.C:41
libMesh::TransientRBEvaluation::RB_initial_condition_all_N
std::vector< DenseVector< Number > > RB_initial_condition_all_N
The RB initial conditions (i.e.
Definition: transient_rb_evaluation.h:218
libMesh::RBDataDeserialization::RBEvaluationDeserialization::RBEvaluationDeserialization
RBEvaluationDeserialization(RBEvaluation &rb_eval)
Initialize a new buffer using the structure from the Cap'n'Proto schema described in rb_data....
Definition: rb_data_deserialization.C:70
libMesh::DofObject::set_id
dof_id_type & set_id()
Definition: dof_object.h:776
libMesh::RBDataDeserialization::RBSCMEvaluationDeserialization::_rb_scm_eval
RBSCMEvaluation & _rb_scm_eval
The RBSCMEvaluation object we will read into.
Definition: rb_data_deserialization.h:188
libMesh::RBDataDeserialization::RBEvaluationDeserialization::_rb_eval
RBEvaluation & _rb_eval
The RBEvaluation object that we will read into.
Definition: rb_data_deserialization.h:85
libMesh::index_range
IntRange< std::size_t > index_range(const std::vector< T > &vec)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
Definition: int_range.h:106
libMesh
The libMesh namespace provides an interface to certain functionality in the library.
Definition: factoryfunction.C:55
libMesh::RBEvaluation::output_dual_innerprods
std::vector< std::vector< Number > > output_dual_innerprods
The vector storing the dual norm inner product terms for each output.
Definition: rb_evaluation.h:308
libMesh::TransientRBEvaluation::RB_L2_matrix
DenseMatrix< Number > RB_L2_matrix
Dense RB L2 matrix.
Definition: transient_rb_evaluation.h:166
libMesh::RBParameters
This class is part of the rbOOmit framework.
Definition: rb_parameters.h:42
libMesh::RBSCMEvaluation::SCM_UB_vectors
std::vector< std::vector< Real > > SCM_UB_vectors
This matrix stores the infimizing vectors y_1( ),...,y_Q_a( ), for each in C_J, which are used in co...
Definition: rb_scm_evaluation.h:206
mesh
MeshBase & mesh
Definition: mesh_communication.C:1257
libMesh::ReplicatedMesh::clear
virtual void clear() override
Clear all internal data.
Definition: replicated_mesh.C:593
libMesh::RBEIMEvaluation::interpolation_points_var
std::vector< unsigned int > interpolation_points_var
The corresponding list of variables indices at which the interpolation points were identified.
Definition: rb_eim_evaluation.h:188
libMesh::RBTemporalDiscretization::set_time_step
void set_time_step(const unsigned int k)
Definition: rb_temporal_discretization.C:62
libMesh::ReplicatedMesh
The ReplicatedMesh class is derived from the MeshBase class, and is used to store identical copies of...
Definition: replicated_mesh.h:47
libMesh::TransientRBEvaluation::Fq_Mq_representor_innerprods
std::vector< std::vector< std::vector< Number > > > Fq_Mq_representor_innerprods
Vectors storing the residual representor inner products to be used in computing the residuals online.
Definition: transient_rb_evaluation.h:224
libMesh::RBEIMEvaluation::get_interpolation_points_mesh
ReplicatedMesh & get_interpolation_points_mesh()
Get a writable reference to the interpolation points mesh.
Definition: rb_eim_evaluation.C:98
libMesh::RBSCMEvaluation::C_J_stability_vector
std::vector< Real > C_J_stability_vector
Vector storing the (truth) stability values at the parameters in C_J.
Definition: rb_scm_evaluation.h:198
libMesh::RBDataDeserialization::RBSCMEvaluationDeserialization::RBSCMEvaluationDeserialization
RBSCMEvaluationDeserialization(RBSCMEvaluation &trans_rb_eval)
Initialize a new buffer using the structure from the Cap'n'Proto schema described in rb_data....
Definition: rb_data_deserialization.C:240
libMesh::TransientRBThetaExpansion::get_n_M_terms
virtual unsigned int get_n_M_terms()
Get Q_m, the number of terms in the affine expansion for the mass operator.
Definition: transient_rb_theta_expansion.h:67
libMesh::RBEvaluation::Fq_representor_innerprods
std::vector< Number > Fq_representor_innerprods
Vectors storing the residual representor inner products to be used in computing the residuals online.
Definition: rb_evaluation.h:290
libMesh::RBEvaluation::Fq_Aq_representor_innerprods
std::vector< std::vector< std::vector< Number > > > Fq_Aq_representor_innerprods
Vectors storing the residual representor inner products to be used in computing the residuals online.
Definition: rb_evaluation.h:299
libMesh::TransientRBEvaluation::RB_M_q_vector
std::vector< DenseMatrix< Number > > RB_M_q_vector
Dense matrices for the RB mass matrices.
Definition: transient_rb_evaluation.h:178
libMesh::Point
A Point defines a location in LIBMESH_DIM dimensional Real space.
Definition: point.h:38
libMesh::RBSCMEvaluation::B_min
std::vector< Real > B_min
B_min, B_max define the bounding box.
Definition: rb_scm_evaluation.h:185
libMesh::TransientRBEvaluation::Mq_Mq_representor_innerprods
std::vector< std::vector< std::vector< Number > > > Mq_Mq_representor_innerprods
Definition: transient_rb_evaluation.h:225
libMesh::RBParameters::set_value
void set_value(const std::string &param_name, Real value)
Set the value of the specified parameter.
Definition: rb_parameters.C:47
libMesh::Node
A Node is like a Point, but with more information.
Definition: node.h:52
libMesh::RBDataDeserialization::RBEIMEvaluationDeserialization::RBEIMEvaluationDeserialization
RBEIMEvaluationDeserialization(RBEIMEvaluation &trans_rb_eval)
Initialize a new buffer using the structure from the Cap'n'Proto schema described in rb_data....
Definition: rb_data_deserialization.C:180
libMesh::TransientRBEvaluation
This class is part of the rbOOmit framework.
Definition: transient_rb_evaluation.h:50
libMesh::RBEIMEvaluation
This class is part of the rbOOmit framework.
Definition: rb_eim_evaluation.h:51
libMesh::RBDataDeserialization::load_rb_scm_evaluation_data
void load_rb_scm_evaluation_data(RBSCMEvaluation &rb_scm_eval, RBData::RBSCMEvaluation::Reader &rb_scm_eval_reader)
Load an SCM RB evaluation from a corresponding reader structure in the buffer.
Definition: rb_data_deserialization.C:768
libMesh::Elem::set_node
virtual Node *& set_node(const unsigned int i)
Definition: elem.h:2059
libMesh::RBEvaluation::Aq_Aq_representor_innerprods
std::vector< std::vector< std::vector< Number > > > Aq_Aq_representor_innerprods
Definition: rb_evaluation.h:300
libMesh::RBThetaExpansion::get_n_outputs
unsigned int get_n_outputs() const
Get n_outputs, the number output functionals.
Definition: rb_theta_expansion.C:47
libMesh::RBDataDeserialization::RBEIMEvaluationDeserialization::read_from_file
void read_from_file(const std::string &path)
Write the Cap'n'Proto buffer to disk.
Definition: rb_data_deserialization.C:187
libMesh::RBEvaluation::RB_output_vectors
std::vector< std::vector< DenseVector< Number > > > RB_output_vectors
The vectors storing the RB output vectors.
Definition: rb_evaluation.h:275
libMesh::RBParametrized::initialize_parameters
void initialize_parameters(const RBParameters &mu_min_in, const RBParameters &mu_max_in, const std::map< std::string, std::vector< Real >> &discrete_parameter_values)
Initialize the parameter ranges and set current_parameters.
Definition: rb_parametrized.C:60
libMesh::RBDataDeserialization::load_point
void load_point(RBData::Point3D::Reader point_reader, Point &point)
Helper function that loads point data.
Definition: rb_data_deserialization.C:859
libMesh::RBDataDeserialization::load_elem_into_mesh
void load_elem_into_mesh(RBData::MeshElem::Reader mesh_elem_reader, libMesh::Elem *elem, libMesh::ReplicatedMesh &mesh)
Helper function that loads element data.
Definition: rb_data_deserialization.C:871
libMesh::RBEvaluation::compute_RB_inner_product
bool compute_RB_inner_product
Boolean flag to indicate whether we compute the RB_inner_product_matrix.
Definition: rb_evaluation.h:327
libMesh::RBEvaluation::RB_inner_product_matrix
DenseMatrix< Number > RB_inner_product_matrix
The inner product matrix.
Definition: rb_evaluation.h:255
value
static const bool value
Definition: xdr_io.C:56
libMesh::TransientRBEvaluation::Aq_Mq_representor_innerprods
std::vector< std::vector< std::vector< std::vector< Number > > > > Aq_Mq_representor_innerprods
Definition: transient_rb_evaluation.h:226
libMesh::RBDataDeserialization::RBSCMEvaluationDeserialization::read_from_file
void read_from_file(const std::string &path)
Write the Cap'n'Proto buffer to disk.
Definition: rb_data_deserialization.C:247
libMesh::Elem::subdomain_id
subdomain_id_type subdomain_id() const
Definition: elem.h:2069
libMesh::RBEvaluation
This class is part of the rbOOmit framework.
Definition: rb_evaluation.h:50
libMesh::RBDataDeserialization::TransientRBEvaluationDeserialization::read_from_file
void read_from_file(const std::string &path, bool read_error_bound_data)
Write the Cap'n'Proto buffer to disk.
Definition: rb_data_deserialization.C:129
libMesh::Elem
This is the base class from which all geometric element types are derived.
Definition: elem.h:100
libMesh::RBSCMEvaluation
This class is part of the rbOOmit framework.
Definition: rb_scm_evaluation.h:52
libMesh::TransientRBEvaluation::initial_L2_error_all_N
std::vector< Real > initial_L2_error_all_N
Vector storing initial L2 error for all 1 <= N <= RB_size.
Definition: transient_rb_evaluation.h:212
libMesh::RBThetaExpansion::get_n_A_terms
unsigned int get_n_A_terms() const
Get Q_a, the number of terms in the affine expansion for the bilinear form.
Definition: rb_theta_expansion.C:35
libMesh::RBParametrized
This class is part of the rbOOmit framework.
Definition: rb_parametrized.h:44
libMesh::RBDataDeserialization::RBEvaluationDeserialization::read_from_file
void read_from_file(const std::string &path, bool read_error_bound_data)
Write the Cap'n'Proto buffer to disk.
Definition: rb_data_deserialization.C:78
libMesh::RBEIMEvaluation::interpolation_points
std::vector< Point > interpolation_points
The list of interpolation points, i.e.
Definition: rb_eim_evaluation.h:182
libMesh::RBEvaluation::resize_data_structures
virtual void resize_data_structures(const unsigned int Nmax, bool resize_error_bound_data=true)
Resize and clear the data vectors corresponding to the value of Nmax.
Definition: rb_evaluation.C:108
libMesh::RBEIMEvaluation::interpolation_points_elem
std::vector< Elem * > interpolation_points_elem
The corresponding list of elements at which the interpolation points were identified.
Definition: rb_eim_evaluation.h:194
libMesh::RBDataDeserialization::RBEIMEvaluationDeserialization::~RBEIMEvaluationDeserialization
virtual ~RBEIMEvaluationDeserialization()
Destructor.
Definition: rb_data_deserialization.C:184
libMesh::RBEvaluation::get_rb_theta_expansion
RBThetaExpansion & get_rb_theta_expansion()
Get a reference to the rb_theta_expansion.
Definition: rb_evaluation.C:88
libMesh::Real
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Definition: libmesh_common.h:121
libMesh::RBEvaluation::RB_Fq_vector
std::vector< DenseVector< Number > > RB_Fq_vector
Dense vector for the RHS.
Definition: rb_evaluation.h:265
libMesh::Elem::build
static std::unique_ptr< Elem > build(const ElemType type, Elem *p=nullptr)
Definition: elem.C:246
libMesh::RBEIMEvaluation::interpolation_matrix
DenseMatrix< Number > interpolation_matrix
Dense matrix that stores the lower triangular interpolation matrix that can be used.
Definition: rb_eim_evaluation.h:176
libMesh::RBThetaExpansion
This class stores the set of RBTheta functor objects that define the "parameter-dependent expansion" ...
Definition: rb_theta_expansion.h:44
libMesh::RBTemporalDiscretization::set_euler_theta
void set_euler_theta(const Real euler_theta_in)
Definition: rb_temporal_discretization.C:51
libMesh::RBDataDeserialization::load_parameter_ranges
void load_parameter_ranges(RBParametrized &rb_evaluation, RBData::ParameterRanges::Reader &parameter_ranges, RBData::DiscreteParameterList::Reader &discrete_parameters_list)
Load parameter ranges and discrete parameter values into an RBEvaluation from the corresponding struc...
Definition: rb_data_deserialization.C:287
libMesh::ElemType
ElemType
Defines an enum for geometric element types.
Definition: enum_elem_type.h:33
libMesh::RBDataDeserialization::load_rb_evaluation_data
void load_rb_evaluation_data(RBEvaluation &rb_evaluation, RBEvaluationReaderNumber &rb_evaluation_reader, bool read_error_bound_data)
Load an RB evaluation from a corresponding reader structure in the buffer.
Definition: rb_data_deserialization.C:333
libMesh::RBSCMEvaluation::get_rb_theta_expansion
RBThetaExpansion & get_rb_theta_expansion()
Get a reference to the rb_theta_expansion.
Definition: rb_scm_evaluation.C:72