<commit_before>// The libMesh Finite Element Library.
// Copyright (C) 2002-2012 <NAME>, <NAME>, <NAME>

// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.

// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Lesser General Public License for more details.

// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA



#ifndef LIBMESH_DIFF_CONTEXT_H
#define LIBMESH_DIFF_CONTEXT_H

// Local Includes
#include "libmesh/dense_matrix.h"
#include "libmesh/dense_submatrix.h"
#include "libmesh/dense_subvector.h"
#include "libmesh/dense_vector.h"
#include "libmesh/id_types.h"

// C++ includes
#include <cstddef>
#include <map>
#include <vector>

namespace libMesh
{

// Forward declarations
template <typename T> class NumericVector;
class System;

/**
 * This class provides all data required for a physics package
 * (e.g. a DifferentiableSystem subclass) to perform local element
 * residual and jacobian integrations.
 *
 * This class is part of the new DifferentiableSystem framework,
 * which is still experimental.  Users of this framework should
 * beware of bugs and future API changes.
 *
 * @author <NAME> 2009
 */

// ------------------------------------------------------------
// DifferentiableSystem class definition

class DiffContext
{
public:

  /**
   * Constructor.  Optionally initializes required
   * data structures.
   */
  explicit
  DiffContext (const System &);

  /**
   * Destructor.
   */
  virtual ~DiffContext ();

  /**
   * Gives derived classes the opportunity to reinitialize data (FE objects in
   * FEMSystem, for example) needed for an interior integration at a new point
   * within a timestep
   */
  virtual void elem_reinit(Real) {}

  /**
   * Gives derived classes the opportunity to reinitialize data needed
   * for a side integration at a new point within a timestep
   */
  virtual void elem_side_reinit(Real) {}

  /**
   * Gives derived classes the opportunity to reinitialize data needed
   * for an edge integration at a new point within a timestep
   */
  virtual void elem_edge_reinit(Real) {}

  /**
   * Number of variables in solution.
   */
  unsigned int n_vars() const
  { return libmesh_cast_int<unsigned int>(dof_indices_var.size()); }

  /**
   * Accessor for associated system.
   */
  const System& get_system() const
  { return _system; }

  /**
   * Accessor for element solution.
   */
  const DenseVector<Number>& get_elem_solution() const
  { return elem_solution; }

  /**
   * Accessor for element solution of a particular variable corresponding
   * to the variable index argument.
   */
  const DenseSubVector<Number>& get_elem_solution( unsigned int var ) const
  { return *(elem_subsolutions[var]); }

  /**
   * Accessor for element fixed solution.
   */
  const DenseVector<Number>& get_elem_fixed_solution() const
  { return elem_fixed_solution; }
<commit_msg>Need non-const versions of these accessors. I'm not convinced this is the right way to go here, but rolling with it for now.<commit_after>// The libMesh Finite Element Library.
// Copyright (C) 2002-2012 <NAME>, <NAME>, <NAME>

// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.

// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Lesser General Public License for more details.

// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA



#ifndef LIBMESH_DIFF_CONTEXT_H
#define LIBMESH_DIFF_CONTEXT_H

// Local Includes
#include "libmesh/dense_matrix.h"
#include "libmesh/dense_submatrix.h"
#include "libmesh/dense_subvector.h"
#include "libmesh/dense_vector.h"
#include "libmesh/id_types.h"

// C++ includes
#include <cstddef>
#include <map>
#include <vector>

namespace libMesh
{

// Forward declarations
template <typename T> class NumericVector;
class System;

/**
 * This class provides all data required for a physics package
 * (e.g. a DifferentiableSystem subclass) to perform local element
 * residual and jacobian integrations.
 *
 * This class is part of the new DifferentiableSystem framework,
 * which is still experimental.  Users of this framework should
 * beware of bugs and future API changes.
 *
 * @author <NAME> 2009
 */

// ------------------------------------------------------------
// DifferentiableSystem class definition

class DiffContext
{
public:

  /**
   * Constructor.  Optionally initializes required
   * data structures.
   */
  explicit
  DiffContext (const System &);

  /**
   * Destructor.
   */
  virtual ~DiffContext ();

  /**
   * Gives derived classes the opportunity to reinitialize data (FE objects in
   * FEMSystem, for example) needed for an interior integration at a new point
   * within a timestep
   */
  virtual void elem_reinit(Real) {}

  /**
   * Gives derived classes the opportunity to reinitialize data needed
   * for a side integration at a new point within a timestep
   */
  virtual void elem_side_reinit(Real) {}

  /**
   * Gives derived classes the opportunity to reinitialize data needed
   * for an edge integration at a new point within a timestep
   */
  virtual void elem_edge_reinit(Real) {}

  /**
   * Number of variables in solution.
   */
  unsigned int n_vars() const
  { return libmesh_cast_int<unsigned int>(dof_indices_var.size()); }

  /**
   * Accessor for associated system.
   */
  const System& get_system() const
  { return _system; }

  /**
   * Accessor for element solution.
   */
  const DenseVector<Number>& get_elem_solution() const
  { return elem_solution; }

  /**
   * Non-const accessor for element solution.
   */
  DenseVector<Number>& get_elem_solution()
  { return elem_solution; }

  /**
   * Accessor for element solution of a particular variable corresponding
   * to the variable index argument.
   */
  const DenseSubVector<Number>& get_elem_solution( unsigned int var ) const
  { return *(elem_subsolutions[var]); }

  /**
   * Accessor for element fixed solution.
   */
  const DenseVector<Number>& get_elem_fixed_solution() const
  { return elem_fixed_solution; }

  /**
   * Non-const accessor for element fixed solution.
   */
  DenseVector<Number>& get_elem_fixed_solution()
  { return elem_fixed_solution; }

{'fraction_non_alphanumeric': 0.10260380014074595, 'fraction_numerical': 0.007881773399014778, 'mean_word_length': 3.335570469798658, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7124954', 'n_tokens_mistral': 2063, 'n_tokens_neox': 1963, 'n_words': 787}