Smith  0.1
Smith is an implicit thermal structural mechanics simulation code.
scalar_objective.hpp
Go to the documentation of this file.
1 // Copyright Lawrence Livermore National Security, LLC and
2 // other Smith Project Developers. See the top-level LICENSE file for
3 // details.
4 //
5 // SPDX-License-Identifier: (BSD-3-Clause)
6 
13 #pragma once
14 
15 #include <vector>
16 #include "smith/physics/common.hpp"
18 
19 namespace mfem {
20 class Vector;
21 } // namespace mfem
22 
23 namespace smith {
24 
25 class FiniteElementState;
26 
29  public:
31  ScalarObjective(const std::string& name) : name_(name) {}
32 
34  virtual ~ScalarObjective() {}
35 
44  virtual double evaluate(TimeInfo time_info, ConstFieldPtr shape_disp,
45  const std::vector<ConstFieldPtr>& fields) const = 0;
46 
55  virtual mfem::Vector gradient(TimeInfo time_info, ConstFieldPtr shape_disp, const std::vector<ConstFieldPtr>& fields,
56  size_t field_ordinal) const = 0;
57 
66  virtual mfem::Vector gradient(TimeInfo time_info, ConstFieldPtr shape_disp, const std::vector<ConstFieldPtr>& fields,
67  int field_ordinal) const
68  {
69  return gradient(time_info, shape_disp, fields, static_cast<size_t>(field_ordinal));
70  }
71 
79  virtual mfem::Vector mesh_coordinate_gradient(TimeInfo time_info, ConstFieldPtr shape_disp,
80  const std::vector<ConstFieldPtr>& fields) const = 0;
81 
83  std::string name() const { return name_; }
84 
85  private:
87  std::string name_;
88 };
89 
90 } // namespace smith
Abstract residual class.
virtual double evaluate(TimeInfo time_info, ConstFieldPtr shape_disp, const std::vector< ConstFieldPtr > &fields) const =0
Virtual interface for computing the scale value for the objective/constrant, given a vector of smith:...
virtual ~ScalarObjective()
destructor
virtual mfem::Vector mesh_coordinate_gradient(TimeInfo time_info, ConstFieldPtr shape_disp, const std::vector< ConstFieldPtr > &fields) const =0
Virtual interface for computing objective gradient with respect to the mesh coordinates.
virtual mfem::Vector gradient(TimeInfo time_info, ConstFieldPtr shape_disp, const std::vector< ConstFieldPtr > &fields, int field_ordinal) const
Compute objective gradient from a vector of FiniteElementState*, using int for index.
std::string name() const
name
ScalarObjective(const std::string &name)
base constructor takes the name of the physics
virtual mfem::Vector gradient(TimeInfo time_info, ConstFieldPtr shape_disp, const std::vector< ConstFieldPtr > &fields, size_t field_ordinal) const =0
Virtual interface for computing objective gradient from a vector of smith::FiniteElementState*.
A file defining some enums and structs that are used by the different physics modules.
Defines common types and helper functions for using the residual and scalar_objective classes.
Accelerator functionality.
Definition: smith.cpp:36
FiniteElementState const * ConstFieldPtr
using
Definition: field_types.hpp:36
struct storing time and timestep information
Definition: common.hpp:18