本文整理汇总了C++中StringT::Root方法的典型用法代码示例。如果您正苦于以下问题:C++ StringT::Root方法的具体用法?C++ StringT::Root怎么用?C++ StringT::Root使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringT
的用法示例。
在下文中一共展示了StringT::Root方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetIterationInfo
/* collect global and local iterations info for each time step */
void MRSSKStV::GetIterationInfo(bool get_iters, int loc_iters)
{
if(get_iters) {
/* write data */
const StringT& input_file = fSSMatSupport->InputFile();
/* output filenames */
StringT iterdata;
iterdata.Root(input_file);
iterdata.Append(".iterdata.", fSSMatSupport->StepNumber());
/* open output streams */
ofstreamT out_idata(iterdata);
/* write */
out_idata << "Time step number: " << setw(kIntWidth)
<< fSSMatSupport->StepNumber() << endl;
out_idata << "Global iteration number:" << setw(kIntWidth)
<< fSSMatSupport->GroupIterationNumber() << endl;
out_idata << "Number of local iterations to converge:" << setw(kIntWidth)
<< loc_iters << endl;
out_idata.close(); /* close */
} // if(get_iters)
}
示例2: InitialStress
/* read initial stress from file */
void MRSSKStV::InitialStress(dSymMatrixT& Stress0)
{
int ip = CurrIP();
ElementCardT& element = CurrentElement();
/* read data from file */
const StringT& input_file = fSSMatSupport->InputFile();
StringT InitialStressData;
InitialStressData.Root(input_file);
// read element by element, ip by ip
// if data is generated by a program
Stress0=0.;
}
示例3: atoi
/* construct extracting dimensions from the name */
MatrixParameterT::MatrixParameterT(const StringT& name_NxM, char variable):
ParameterInterfaceT(name_NxM),
fVariable(variable),
fCopySymmetric(false)
{
const char caller[] = "MatrixParameterT::MatrixParameterT";
const char msg[] = "could not extract %s dimensions from \"%s\" in \"%s\"";
/* resolve suffix */
StringT suffix;
suffix.Suffix(name_NxM, '_');
if (suffix.StringLength() < 4)
ExceptionT::GeneralFail(caller, msg, "matrix", suffix.Pointer(), name_NxM.Pointer());
/* resolve column dimensions */
StringT num;
num.Suffix(suffix, 'x');
if (num.StringLength() < 2 || !isdigit(num[1]))
ExceptionT::GeneralFail(caller, msg, "col", num.Pointer(), name_NxM.Pointer());
int col = -1;
col = atoi(num.Pointer(1));
if (col < 0)
ExceptionT::GeneralFail(caller, msg, "col", num.Pointer(), name_NxM.Pointer());
/* resolve row dimensions */
suffix.Root('x');
if (suffix.StringLength() < 2 || !isdigit(suffix[1]))
ExceptionT::GeneralFail(caller, msg, "row", suffix.Pointer(), name_NxM.Pointer());
int row = -1;
row = atoi(suffix.Pointer(1));
if (row < 0)
ExceptionT::GeneralFail(caller, msg, "row", suffix.Pointer(), name_NxM.Pointer());
/* initialize */
fMatrix.Dimension(row, col);
fMatrix = 0.0;
}
示例4: TakeParameterList
//.........这里部分代码省略.........
"failed at node %d\n",fNodes[i]);
nodal_phi[i].AppendArray(fNodalShapes->FieldAt().Length(),
const_cast <double *> (fNodalShapes->FieldAt().Pointer()));
nodal_supports[i].AppendArray(fNodalShapes->Neighbors().Length(),
const_cast <int *> (fNodalShapes->Neighbors().Pointer()));
}
// move into RaggedArray2DT's
// move into more efficient storage for computation
fNodalPhi.Configure(nodal_phi);
fNodalSupports.Configure(nodal_supports);
if (nodal_supports.Length() != nodal_phi.Length())
ExceptionT::GeneralFail(caller,"nodal support indices and shape function values do not match\n");
for (int i = 0; i < nodal_supports.Length(); i++) {
int* irow_i = fNodalSupports(i);
double* drow_i = fNodalPhi(i);
LinkedListT<int>& ilist = nodal_supports[i];
LinkedListT<double>& dlist = nodal_phi[i];
ilist.Top(); dlist.Top();
while (ilist.Next() && dlist.Next()) {
*irow_i++ = *(ilist.CurrentValue());
*drow_i++ = *(dlist.CurrentValue());
}
}
/* output nodal shape function information */
if (ElementSupport().Logging() == GlobalT::kVerbose)
{
/* output file root */
StringT root;
root.Root(ElementSupport().InputFile());
ofstreamT out;
/* nodal neighbors */
StringT neighbor_file = root;
neighbor_file.Append(".", Name(), ".nodal_neighbors");
out.open(neighbor_file);
fNodalShapes->MeshFreeSupport().WriteNodalNeighbors(out);
out.close();
/* nodal shape functions */
StringT shape_file = root;
shape_file.Append(".", Name(), ".nodal_phi");
out.open(shape_file);
fNodalShapes->MeshFreeSupport().WriteNodalShapes(out);
out.close();
}
// store shape function information for boundary integration
fCellGeometry->BoundaryShapeFunctions(fBoundaryPhi, fBoundarySupports, fBoundaryFacetNormals);
/* material Data */
ParameterListT mat_params;
CollectMaterialInfo(list, mat_params);
fMaterialList = NewMaterialList(mat_params.Name(), mat_params.NumLists());
if (!fMaterialList)
ExceptionT::GeneralFail(caller,"could not construct material list \"%s\"", mat_params.Name().Pointer());
fMaterialList->TakeParameterList(mat_params);
/* body force */
const ParameterListT* body_force = list.List("body_force");
if (body_force) {
示例5: TakeParameterList
//.........这里部分代码省略.........
fNumIntPts = geom.GetParameter("num_ip");
/* inherited */
ElementBaseT::TakeParameterList(list);
/* take parameters */
fCloseSurfaces = list.GetParameter("close_surfaces");
fOutputArea = list.GetParameter("output_area");
/* pre-crack */
const ParameterListT* pre_crack = list.List("pre_crack");
if (pre_crack) {
fpc_AndOr = int2AndOrT(pre_crack->GetParameter("and_or"));
int num_rules = pre_crack->NumLists("pre_crack_rule");
fpc_coordinate.Dimension(num_rules);
fpc_op.Dimension(num_rules);
fpc_value.Dimension(num_rules);
for (int i = 0; i < num_rules; i++) {
const ParameterListT& pre_crack_rule = pre_crack->GetList("pre_crack_rule", i);
fpc_coordinate[i] = int2CoordinateT(pre_crack_rule.GetParameter("coordinate"));
fpc_op[i] = int2OpT(pre_crack_rule.GetParameter("op"));
fpc_value[i] = pre_crack_rule.GetParameter("value");
}
}
/* nodal output codes */
fNodalOutputCodes.Dimension(NumNodalOutputCodes);
fNodalOutputCodes = 0;
const ParameterListT* nodal_output = list.List("surface_element_nodal_output");
if (nodal_output)
for (int i = 0; i < NumNodalOutputCodes; i++)
{
/* look for entry */
const ParameterT* nodal_value = nodal_output->Parameter(NodalOutputNames[i]);
if (nodal_value) {
int do_write = *nodal_value;
if (do_write == 1)
fNodalOutputCodes[i] = 1;
else if (i == NodalTraction && do_write == 2) {
fNodalOutputCodes[i] = 1;
fOutputGlobalTractions = true;
}
}
}
/* element output codes */
fElementOutputCodes.Dimension(NumElementOutputCodes);
fElementOutputCodes = 0;
const ParameterListT* element_output = list.List("surface_element_element_output");
if (element_output)
for (int i = 0; i < NumElementOutputCodes; i++)
{
/* look for entry */
const ParameterT* element_value = element_output->Parameter(ElementOutputNames[i]);
if (element_value) {
int do_write = *element_value;
if (do_write == 1)
fElementOutputCodes[i] = 1;
}
}
/* dimensions */
int num_facet_nodes = NumFacetNodes();
/* initialize local arrays */
fLocInitCoords1.Dimension(num_facet_nodes, NumSD());
fLocCurrCoords.Dimension(NumElementNodes(), NumSD());
ElementSupport().RegisterCoordinates(fLocInitCoords1);
ElementSupport().RegisterCoordinates(fLocCurrCoords);
/* construct surface shape functions */
fShapes = new SurfaceShapeT(fGeometryCode, fNumIntPts, NumElementNodes(),
num_facet_nodes, NumDOF(), fLocInitCoords1);
if (!fShapes) throw ExceptionT::kOutOfMemory;
fShapes->Initialize();
/* work space */
fNodes1.Dimension(num_facet_nodes);
int nee = NumElementNodes()*NumDOF();
fNEEvec.Dimension(nee);
fNEEmat.Dimension(nee);
/* close surfaces */
if (fCloseSurfaces) CloseSurfaces();
#ifndef _FRACTURE_INTERFACE_LIBRARY_
/* output stream */
if (fOutputArea == 1)
{
/* generate file name */
StringT name = ElementSupport().InputFile();
name.Root();
name.Append(".grp", ElementSupport().ElementGroupNumber(this) + 1);
name.Append(".fracture");
/* open stream */
farea_out.open(name);
}
#endif
}
示例6: WriteOutput
void ContactElementT::WriteOutput(void)
{
ExceptionT::GeneralFail("ContactElementT::WriteOutput", "out of date");
#if 0
// look at EXODUS output in continuumelementT
/* contact statistics */
ostream& out = ElementSupport().Output();
out << "\n Contact tracking: group "
<< ElementSupport().ElementGroupNumber(this) + 1 << '\n';
out << " Time = "
<< ElementSupport().Time() << '\n';
if (fNumOutputVariables) {
for(int s = 0; s < fSurfaces.Length(); s++) {
const ContactSurfaceT& surface = fSurfaces[s];
dArray2DT n_values(surface.GlobalNodeNumbers().Length(),
fNumOutputVariables);
n_values = 0.0;
surface.CollectOutput(fOutputFlags,n_values);
dArray2DT e_values;
/* send to output */
ElementSupport().WriteOutput(fOutputID[s], n_values, e_values);
}
}
/* output files */
StringT filename;
filename.Root(ElementSupport().Input().filename());
filename.Append(".", ElementSupport().StepNumber());
filename.Append("of", ElementSupport().NumberOfSteps());
for(int s = 0; s < fSurfaces.Length(); s++) {
const ContactSurfaceT& surface = fSurfaces[s];
#if TEXT_OUTPUT
if (fOutputFlags[kGaps]) {
StringT gap_out;
gap_out = gap_out.Append(filename,".gap");
gap_out = gap_out.Append(s);
ofstream gap_file (gap_out);
surface.PrintGaps(gap_file);
}
if (fOutputFlags[kMultipliers]) {
// surface.PrintMultipliers(cout);
StringT pressure_out;
pressure_out = pressure_out.Append(filename,".pre");
pressure_out = pressure_out.Append(s);
ofstream pressure_file (pressure_out);
surface.PrintMultipliers(pressure_file);
}
if (fOutputFlags[kNormals]) {
StringT normal_out;
normal_out = normal_out.Append(filename,".normal");
normal_out = normal_out.Append(s);
ofstream normal_file (normal_out);
surface.PrintNormals(normal_file);
}
#endif
if (fOutputFlags[kMultipliers]) { surface.PrintMultipliers(cout);}
if (fOutputFlags[kStatus]) { surface.PrintStatus(cout); }
if (fOutputFlags[kArea]) { surface.PrintContactArea(cout); }
}
#endif
}