~chaffra/+junk/trilinos

« back to all changes in this revision

Viewing changes to packages/Sundance/src-std-framework/Problem/SundanceNLOp.hpp

  • Committer: Bazaar Package Importer
  • Author(s): Christophe Prud'homme, Christophe Prud'homme, Johannes Ring
  • Date: 2009-12-13 12:53:22 UTC
  • mfrom: (5.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20091213125322-in0nrdjc55deqsw9
Tags: 10.0.3.dfsg-1
[Christophe Prud'homme]
* New upstream release

[Johannes Ring]
* debian/patches/libname.patch: Add prefix 'libtrilinos_' to all
  libraries. 
* debian/patches/soname.patch: Add soversion to libraries.
* debian/watch: Update download URL.
* debian/control:
  - Remove python-numeric from Build-Depends (virtual package).
  - Remove automake and autotools from Build-Depends and add cmake to
    reflect switch to CMake.
  - Add python-support to Build-Depends.
* debian/rules: 
  - Cleanup and updates for switch to CMake.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* @HEADER@ */
 
2
// ************************************************************************
 
3
// 
 
4
//                              Sundance
 
5
//                 Copyright (2005) Sandia Corporation
 
6
// 
 
7
// Copyright (year first published) Sandia Corporation.  Under the terms 
 
8
// of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government 
 
9
// retains certain rights in this software.
 
10
// 
 
11
// This library is free software; you can redistribute it and/or modify
 
12
// it under the terms of the GNU Lesser General Public License as
 
13
// published by the Free Software Foundation; either version 2.1 of the
 
14
// License, or (at your option) any later version.
 
15
//  
 
16
// This library is distributed in the hope that it will be useful, but
 
17
// WITHOUT ANY WARRANTY; without even the implied warranty of
 
18
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
19
// Lesser General Public License for more details.
 
20
//                                                                                 
 
21
// You should have received a copy of the GNU Lesser General Public
 
22
// License along with this library; if not, write to the Free Software
 
23
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 
24
// USA                                                                                
 
25
// Questions? Contact Kevin Long (krlong@sandia.gov), 
 
26
// Sandia National Laboratories, Livermore, California, USA
 
27
// 
 
28
// ************************************************************************
 
29
/* @HEADER@ */
 
30
 
 
31
#ifndef SUNDANCE_NLOP_H
 
32
#define SUNDANCE_NLOP_H
 
33
 
 
34
#include "SundanceDefs.hpp"
 
35
#include "SundanceMesh.hpp"
 
36
#include "SundanceExpr.hpp"
 
37
#include "SundanceDiscreteFunction.hpp"
 
38
#include "SundanceObjectWithVerbosity.hpp"
 
39
#include "TSFNonlinearOperatorBase.hpp"
 
40
#include "TSFLinearOperatorDecl.hpp"
 
41
#include "TSFVectorDecl.hpp"
 
42
#include "TSFVectorType.hpp"
 
43
 
 
44
namespace SundanceStdFwk
 
45
{
 
46
using namespace SundanceUtils;
 
47
using namespace SundanceStdMesh;
 
48
using namespace SundanceStdMesh::Internal;
 
49
using namespace SundanceCore;
 
50
using namespace SundanceCore;
 
51
using namespace Teuchos;
 
52
namespace Internal
 
53
{
 
54
class Assembler;
 
55
}
 
56
 
 
57
/** 
 
58
 * NLOp encapsulates a discrete nonlinear problem, and can
 
59
 * be passed to a nonlinear solver such as NOX.
 
60
 */
 
61
class NLOp 
 
62
  : public SundanceUtils::ObjectWithClassVerbosity<NLOp>,
 
63
    public TSFExtended::NonlinearOperatorBase<double>
 
64
{
 
65
public:
 
66
  /** Empty ctor */
 
67
  NLOp();
 
68
 
 
69
  /** Construct with a mesh, equation set, bcs, test and unknown funcs,
 
70
   * and a vector type */
 
71
  NLOp(const Mesh& mesh, const Expr& eqn, const Expr& bc,
 
72
    const Expr& test, const Expr& unk, const Expr& u0, 
 
73
    const TSFExtended::VectorType<double>& vecType,
 
74
    bool partitionBCs = false);
 
75
 
 
76
  /** Construct with a mesh, equation set, bcs, test and unknown funcs,
 
77
   * parameters, and a vector type */
 
78
  NLOp(const Mesh& mesh, const Expr& eqn, const Expr& bc,
 
79
    const Expr& test, const Expr& unk, const Expr& u0, 
 
80
    const Expr& params, const Expr& paramVals,  
 
81
    const TSFExtended::VectorType<double>& vecType,
 
82
    bool partitionBCs = false);
 
83
 
 
84
 
 
85
  /** */
 
86
  NLOp(const RefCountPtr<Assembler>& assembler, 
 
87
    const Expr& u0);
 
88
 
 
89
  /** Compute the residual and Jacobian at the current evaluation point */
 
90
  LinearOperator<double> computeJacobianAndFunction(Vector<double>& functionValue) const ;
 
91
 
 
92
  /** Write the Jacobian and residual into the objects provided */
 
93
  void computeJacobianAndFunction(LinearOperator<double>& J,
 
94
    Vector<double>& resid) const ;
 
95
 
 
96
  /** Compute direct sensitivities to parameters */
 
97
  Expr computeSensitivities(const LinearSolver<double>& solver) const ;
 
98
      
 
99
 
 
100
  /** Return the current evaluation point as a Sundance expression */
 
101
  Expr getU0() const {return u0_;}
 
102
 
 
103
  /** Compute the residual at the current eval point */
 
104
  TSFExtended::Vector<double> computeFunctionValue() const ;
 
105
      
 
106
  /** Write the residual into the object provided */
 
107
  void computeFunctionValue(Vector<double>& resid) const ;
 
108
 
 
109
  /** Get an initial guess */
 
110
  TSFExtended::Vector<double> getInitialGuess() const ;
 
111
 
 
112
  /** Create the Jacobian object, but don't fill it in. */
 
113
  LinearOperator<double> allocateJacobian() const ;
 
114
 
 
115
  /** Set an initial guess */
 
116
  void setInitialGuess(const Expr& u0New);
 
117
 
 
118
 
 
119
  /* Handle boilerplate */
 
120
  GET_RCP(TSFExtended::NonlinearOperatorBase<double>);
 
121
 
 
122
private:
 
123
      
 
124
  /** */
 
125
  RefCountPtr<Assembler> assembler_;
 
126
 
 
127
  /** */
 
128
  mutable TSFExtended::LinearOperator<double> J_;
 
129
 
 
130
  /** */
 
131
  Expr u0_;
 
132
 
 
133
  /** */
 
134
  Expr params_;
 
135
 
 
136
  /** */
 
137
  Expr paramVals_;
 
138
 
 
139
  /** */
 
140
  mutable DiscreteFunction* discreteU0_;
 
141
      
 
142
};
 
143
}
 
144
 
 
145
 
 
146
 
 
147
 
 
148
#endif