Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/development' into pr/landinjm/232
Browse files Browse the repository at this point in the history
  • Loading branch information
landinjm committed Sep 5, 2024
2 parents 7fd96e4 + ebecacf commit 5c613c5
Show file tree
Hide file tree
Showing 31 changed files with 6,327 additions and 5,545 deletions.
37 changes: 18 additions & 19 deletions applications/precipitateEvolution_pfunction/PLibrary/PLibrary.hh
Original file line number Diff line number Diff line change
Expand Up @@ -6,37 +6,36 @@
#ifndef PLIBRARY_HH
#define PLIBRARY_HH

#include<cstring>
#include "IntegrationTools/PFunction.hh"
#include "IntegrationTools/PPieceWise.hh"

#include <cstring>

namespace PRISMS
{

/// Library where you can find functions and basis sets
///
namespace PLibrary
{
// Use these functions to checkout objects which manage their own memory

void checkout( std::string name, PSimpleFunction< double*, double > &simplefunc);

void checkout( std::string name, PFunction< double*, double > &func);




// Use these functions to checkout new 'Base' objects which the user must delete
/// Library where you can find functions and basis sets
///
namespace PLibrary
{
// Use these functions to checkout objects which manage their own memory

void checkout( std::string name, PSimpleBase< double*, double > *&simplefunc);
void
checkout(std::string name, PSimpleFunction<double *, double> &simplefunc);

void checkout( std::string name, PFuncBase< double*, double > *&func);
void
checkout(std::string name, PFunction<double *, double> &func);

// Use these functions to checkout new 'Base' objects which the user must delete

void
checkout(std::string name, PSimpleBase<double *, double> *&simplefunc);

}
void
checkout(std::string name, PFuncBase<double *, double> *&func);

}
} // namespace PLibrary

} // namespace PRISMS

#endif
246 changes: 127 additions & 119 deletions applications/precipitateEvolution_pfunction/PLibrary/pfunct_McV.hh
Original file line number Diff line number Diff line change
Expand Up @@ -6,128 +6,136 @@
#ifndef pfunct_McV_HH
#define pfunct_McV_HH

#include "IntegrationTools/PFunction.hh"

#include <cmath>
#include <cstdlib>
#include "IntegrationTools/PFunction.hh"

namespace PRISMS
{
template< class VarContainer>
class pfunct_McV_f : public PSimpleBase< VarContainer, double>
{
double eval( const VarContainer &var) const
{
return 1.0000000000000000e+00;
}

public:

pfunct_McV_f()
{
this->_name = "pfunct_McV_f";
}

std::string csrc() const
{
return "1.0000000000000000e+00";
}

std::string sym() const
{
return "1.0";
}

std::string latex() const
{
return "1.0";
}

pfunct_McV_f* clone() const
{
return new pfunct_McV_f(*this);
}
};

template<class VarContainer>
class pfunct_McV : public PFuncBase< VarContainer, double>
{
public:

typedef typename PFuncBase< VarContainer, double>::size_type size_type;

PSimpleBase< VarContainer, double> *_val;
PSimpleBase< VarContainer, double> **_grad_val;
PSimpleBase< VarContainer, double> ***_hess_val;

pfunct_McV()
{
construct();
}

pfunct_McV(const pfunct_McV &RHS )
{
construct(false);

_val = RHS._val->clone();

}

pfunct_McV& operator=( pfunct_McV RHS )
{
using std::swap;

swap(_val, RHS._val);

return *this;
}

~pfunct_McV()
{
delete _val;

}

pfunct_McV<VarContainer>* clone() const
{
return new pfunct_McV<VarContainer>(*this);
}

PSimpleFunction< VarContainer, double> simplefunction() const
{
return PSimpleFunction< VarContainer, double>( *_val );
}

double operator()(const VarContainer &var)
{
return (*_val)(var);
}

void eval(const VarContainer &var)
{
(*_val)(var);
}

double operator()() const
{
return (*_val)();
}

private:
void construct(bool allocate = true)
{
this->_name = "pfunct_McV";
this->_var_name.clear();
this->_var_name.push_back("c");
this->_var_description.clear();
this->_var_description.push_back("concentration");

if(!allocate) return;

_val = new pfunct_McV_f<VarContainer>();
}

};


}
template <class VarContainer>
class pfunct_McV_f : public PSimpleBase<VarContainer, double>
{
double
eval(const VarContainer &var) const
{
return 1.0000000000000000e+00;
}

public:
pfunct_McV_f()
{
this->_name = "pfunct_McV_f";
}

std::string
csrc() const
{
return "1.0000000000000000e+00";
}

std::string
sym() const
{
return "1.0";
}

std::string
latex() const
{
return "1.0";
}

pfunct_McV_f *
clone() const
{
return new pfunct_McV_f(*this);
}
};

template <class VarContainer>
class pfunct_McV : public PFuncBase<VarContainer, double>
{
public:
typedef typename PFuncBase<VarContainer, double>::size_type size_type;

PSimpleBase<VarContainer, double> *_val;
PSimpleBase<VarContainer, double> **_grad_val;
PSimpleBase<VarContainer, double> ***_hess_val;

pfunct_McV()
{
construct();
}

pfunct_McV(const pfunct_McV &RHS)
{
construct(false);

_val = RHS._val->clone();
}

pfunct_McV &
operator=(pfunct_McV RHS)
{
using std::swap;

swap(_val, RHS._val);

return *this;
}

~pfunct_McV()
{
delete _val;
}

pfunct_McV<VarContainer> *
clone() const
{
return new pfunct_McV<VarContainer>(*this);
}

PSimpleFunction<VarContainer, double>
simplefunction() const
{
return PSimpleFunction<VarContainer, double>(*_val);
}

double
operator()(const VarContainer &var)
{
return (*_val)(var);
}

void
eval(const VarContainer &var)
{
(*_val)(var);
}

double
operator()() const
{
return (*_val)();
}

private:
void
construct(bool allocate = true)
{
this->_name = "pfunct_McV";
this->_var_name.clear();
this->_var_name.push_back("c");
this->_var_description.clear();
this->_var_description.push_back("concentration");

if (!allocate)
return;

_val = new pfunct_McV_f<VarContainer>();
}
};

} // namespace PRISMS
#endif
Loading

0 comments on commit 5c613c5

Please sign in to comment.