uncollatedFileOperation.C
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2017 OpenFOAM Foundation
9 Copyright (C) 2020-2022 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27\*---------------------------------------------------------------------------*/
28
30#include "Time.H"
31#include "Fstream.H"
33#include "decomposedBlockData.H"
34#include "dummyISstream.H"
36
37/* * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * */
38
39namespace Foam
40{
41namespace fileOperations
42{
45
46 // Mark as not needing threaded mpi
48 (
51 word,
52 uncollated
53 );
54}
55}
56
57
58// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
59
61(
62 const bool checkGlobal,
63 const bool isFile,
64 const IOobject& io,
65 const bool search
66) const
67{
68 if (io.instance().isAbsolute())
69 {
71
73 {
74 return objectPath;
75 }
76 }
77 else
78 {
81
83 {
84 return objectPath;
85 }
86 else
87 {
88 if
89 (
90 checkGlobal
91 && io.time().processorCase()
92 && (
93 io.instance() == io.time().system()
94 || io.instance() == io.time().constant()
95 )
96 )
97 {
98 // Constant & system can come from global case
99
100 fileName parentObjectPath =
102 /io.instance()/io.db().dbDir()/io.local()/io.name();
103
104 if (isFileOrDir(isFile, parentObjectPath))
105 {
106 return parentObjectPath;
107 }
108 }
109
110 // Check if parallel "procesors" directory
111 if (io.time().processorCase())
112 {
114 (
116 (
117 io.objectPath(),
118 false // No additional parallel synchronisation
119 )
120 );
121
122 for (const dirIndex& dirIdx : pDirs())
123 {
124 const fileName& pDir = dirIdx.first();
125 fileName objPath =
126 processorsPath(io, io.instance(), pDir)
127 /io.name();
128 if (objPath != objectPath && isFileOrDir(isFile, objPath))
129 {
130 return objPath;
131 }
132 }
133 }
134
135
136 // Check for approximately same time. E.g. if time = 1e-2 and
137 // directory is 0.01 (due to different time formats)
138 if (search && !Foam::isDir(path))
139 {
140 word newInstancePath = io.time().findInstancePath
141 (
143 );
144
145 if (newInstancePath.size())
146 {
147 fileName fName
148 (
150 /newInstancePath/io.db().dbDir()/io.local()/io.name()
151 );
152
153 if (isFileOrDir(isFile, fName))
154 {
155 return fName;
156 }
157 }
158 }
159 }
160 }
161
162 return fileName::null;
163}
164
165
168(
169 const fileName& fName
170) const
171{
172 // No additional parallel synchronisation
174}
175
176
177// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
178
180(
181 bool verbose
182)
183:
184 fileOperation(Pstream::worldComm)
185{
186 if (verbose)
187 {
189 << "I/O : " << typeName << endl;
190 }
191}
192
193
194// * * * * * * * * * * * * * Filesystem Operations * * * * * * * * * * * * * //
195
197(
198 const fileName& dir,
199 mode_t mode
200) const
201{
202 return Foam::mkDir(dir, mode);
203}
204
205
207(
208 const fileName& fName,
209 mode_t mode
210) const
211{
212 return Foam::chMod(fName, mode);
213}
214
215
217(
218 const fileName& fName,
219 const bool followLink
220) const
221{
222 return Foam::mode(fName, followLink);
223}
224
225
227(
228 const fileName& fName,
229 const bool followLink
230) const
231{
232 return Foam::type(fName, followLink);
233}
234
235
237(
238 const fileName& fName,
239 const bool checkGzip,
240 const bool followLink
241) const
242{
243 return Foam::exists(fName, checkGzip, followLink);
244}
245
246
248(
249 const fileName& fName,
250 const bool followLink
251) const
252{
253 return Foam::isDir(fName, followLink);
254}
255
256
258(
259 const fileName& fName,
260 const bool checkGzip,
261 const bool followLink
262) const
263{
264 return Foam::isFile(fName, checkGzip, followLink);
265}
266
267
269(
270 const fileName& fName,
271 const bool followLink
272) const
273{
274 return Foam::fileSize(fName, followLink);
275}
276
277
279(
280 const fileName& fName,
281 const bool followLink
282) const
283{
284 return Foam::lastModified(fName, followLink);
285}
286
287
289(
290 const fileName& fName,
291 const bool followLink
292) const
293{
294 return Foam::highResLastModified(fName, followLink);
295}
296
297
299(
300 const fileName& fName,
301 const std::string& ext
302) const
303{
304 return Foam::mvBak(fName, ext);
305}
306
307
309(
310 const fileName& fName
311) const
312{
313 return Foam::rm(fName);
314}
315
316
318(
319 const fileName& dir,
320 const bool silent
321) const
322{
323 return Foam::rmDir(dir, silent);
324}
325
326
328(
329 const fileName& dir,
330 const fileName::Type type,
331 const bool filtergz,
332 const bool followLink
333) const
334{
335 return Foam::readDir(dir, type, filtergz, followLink);
336}
337
338
340(
341 const fileName& src,
342 const fileName& dst,
343 const bool followLink
344) const
345{
346 return Foam::cp(src, dst, followLink);
347}
348
349
351(
352 const fileName& src,
353 const fileName& dst
354) const
355{
356 return Foam::ln(src, dst);
357}
358
359
361(
362 const fileName& src,
363 const fileName& dst,
364 const bool followLink
365) const
366{
367 return Foam::mv(src, dst, followLink);
368}
369
370
371// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
372
374(
375 const bool checkGlobal,
376 const IOobject& io,
377 const word& typeName,
378 const bool search
379) const
380{
381 if (debug)
382 {
383 Pout<< "uncollatedFileOperation::filePath :"
384 << " objectPath:" << io.objectPath()
385 << " checkGlobal:" << checkGlobal << endl;
386 }
387
388 fileName objPath(filePathInfo(checkGlobal, true, io, search));
389
390 if (debug)
391 {
392 Pout<< "uncollatedFileOperation::filePath :"
393 << " Returning from file searching:" << endl
394 << " objectPath:" << io.objectPath() << endl
395 << " filePath :" << objPath << endl << endl;
396 }
397 return objPath;
398}
399
400
402(
403 const bool checkGlobal,
404 const IOobject& io,
405 const bool search
406) const
407{
408 if (debug)
409 {
410 Pout<< "uncollatedFileOperation::dirPath :"
411 << " objectPath:" << io.objectPath()
412 << " checkGlobal:" << checkGlobal << endl;
413 }
414
415 fileName objPath(filePathInfo(checkGlobal, false, io, search));
416
417 if (debug)
418 {
419 Pout<< "uncollatedFileOperation::dirPath :"
420 << " Returning from directory searching:" << endl
421 << " objectPath:" << io.objectPath() << endl
422 << " dirPath :" << objPath << endl << endl;
423 }
424 return objPath;
425}
426
427
429(
430 const objectRegistry& db,
431 const fileName& instance,
432 const fileName& local,
433 word& newInstance
434) const
435{
436 if (debug)
437 {
438 Pout<< "uncollatedFileOperation::readObjects :"
439 << " db:" << db.objectPath()
440 << " instance:" << instance << endl;
441 }
442
443 //- Use non-time searching version
444 fileNameList objectNames
445 (
446 fileOperation::readObjects(db, instance, local, newInstance)
447 );
448
449 if (newInstance.empty())
450 {
451 // Find similar time
452 fileName newInst = db.time().findInstancePath(instant(instance));
453 if (!newInst.empty() && newInst != instance)
454 {
455 // Try with new time
456 objectNames = fileOperation::readObjects
457 (
458 db,
459 newInst,
460 local,
461 newInstance
462 );
463 }
464 }
465
466 if (debug)
467 {
468 Pout<< "uncollatedFileOperation::readObjects :"
469 << " newInstance:" << newInstance
470 << " objectNames:" << objectNames << endl;
471 }
472
473 return objectNames;
474}
475
476
478(
479 IOobject& io,
480 const fileName& fName,
481 const word& typeName
482) const
483{
484 if (debug)
485 {
486 Pout<< "uncollatedFileOperation::readHeader :"
487 << " fName:" << fName
488 << " typeName:" << typeName << endl;
489 }
490 if (fName.empty())
491 {
492 if (IOobject::debug)
493 {
495 << "file " << io.objectPath() << " could not be opened"
496 << endl;
497 }
498
499 return false;
500 }
501
502 autoPtr<ISstream> isPtr(NewIFstream(fName));
503
504 if (!isPtr || !isPtr->good())
505 {
506 return false;
507 }
508
509 // Regular header or from decomposed data
510 bool ok = decomposedBlockData::readHeader(io, *isPtr);
511
512 if (debug)
513 {
514 Pout<< "uncollatedFileOperation::readHeader :"
515 << " for fName:" << fName
516 << " ok:" << ok
517 << " headerClassName:" << io.headerClassName() << endl;
518 }
519
520 return ok;
521}
522
523
526(
528 const fileName& fName,
529 const word& typeName,
530 const bool valid
531) const
532{
533 if (!valid)
534 {
535 return autoPtr<ISstream>(new dummyISstream());
536 }
537
538 if (fName.empty())
539 {
541 << "cannot find file " << io.objectPath()
542 << exit(FatalError);
543 }
544
545 autoPtr<ISstream> isPtr = NewIFstream(fName);
546
547 if (!isPtr || !isPtr->good())
548 {
550 (
551 "uncollatedFileOperation::readStream()",
552 __FILE__,
553 __LINE__,
554 fName,
555 0
556 ) << "cannot open file"
557 << exit(FatalIOError);
558 }
559 else if (!io.readHeader(*isPtr))
560 {
562 << "problem while reading header for object " << io.name()
563 << exit(FatalIOError);
564 }
565
567 {
568 // Short circuit: non-collated format.
569 return isPtr;
570 }
571 else
572 {
573 // Analyse the objectpath to find out the processor we're trying
574 // to access
575 label proci = detectProcessorPath(io.objectPath());
576
577 if (proci == -1)
578 {
580 << "could not detect processor number"
581 << " from objectPath:" << io.objectPath()
582 << " fName:" << fName
583 << exit(FatalIOError);
584 }
585
586 // Analyse the fileName for any processor subset. Note: this
587 // should really be part of filePath() which should return
588 // both file and index in file.
589 fileName path, procDir, local;
590 procRangeType group;
591 label nProcs;
592 splitProcessorPath(fName, path, procDir, local, group, nProcs);
593
594 // The local rank (offset)
595 if (!group.empty())
596 {
597 proci = proci - group.start();
598 }
599
600 // Read data and return as stream
601 return decomposedBlockData::readBlock(proci, *isPtr, io);
602 }
603}
604
605
607(
609 const bool masterOnly,
611 const word& typeName
612) const
613{
614 bool ok = false;
615
616 if (!masterOnly || Pstream::master(UPstream::worldComm))
617 {
618 if (debug)
619 {
620 Pout<< "uncollatedFileOperation::read :"
621 << " Reading object " << io.objectPath()
622 << " from file " << endl;
623 }
624
625 // Set flag for e.g. codeStream
626 const bool oldGlobal = io.globalObject(masterOnly);
627
628 // If codeStream originates from dictionary which is
629 // not IOdictionary we have a problem so use global
630 const bool oldMasterOnly = regIOobject::masterOnlyReading;
632
633 // Read file
634 ok = io.readData(io.readStream(typeName));
635 io.close();
636
637 // Restore flags
638 io.globalObject(oldGlobal);
639 regIOobject::masterOnlyReading = oldMasterOnly;
640
641 if (debug)
642 {
643 Pout<< "uncollatedFileOperation::read :"
644 << " Done reading object " << io.objectPath()
645 << " from file " << endl;
646 }
647 }
648
649 if (masterOnly && Pstream::parRun())
650 {
652 (
654 io.headerClassName(),
655 io.note()
656 );
657
659 {
660 OPBstream toAll
661 (
664 format
665 );
666 bool okWrite = io.writeData(toAll);
667 ok = ok && okWrite;
668 }
669 else
670 {
671 IPBstream fromMaster
672 (
675 format
676 );
677 ok = io.readData(fromMaster);
678 }
679 }
680
681 return ok;
682}
683
684
687(
688 const fileName& filePath
689) const
690{
691 return autoPtr<ISstream>(new IFstream(filePath));
692}
693
694
697(
698 const fileName& pathName,
699 IOstreamOption streamOpt,
700 const bool valid
701) const
702{
703 return autoPtr<OSstream>(new OFstream(pathName, streamOpt));
704}
705
706
707// ************************************************************************* //
Macros for easy insertion into run-time selection tables.
#define addNamedToRunTimeSelectionTable(baseType, thisType, argNames, lookupName)
Add to construction table with 'lookupName' as the key.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
Input from file stream, using an ISstream.
Definition: IFstream.H:57
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:170
const fileName & caseName() const
Return the Time::caseName()
Definition: IOobject.C:518
const word & name() const noexcept
Return the object name.
Definition: IOobjectI.H:65
const Time & time() const
Return Time associated with the objectRegistry.
Definition: IOobject.C:506
const objectRegistry & db() const noexcept
Return the local objectRegistry.
Definition: IOobject.C:500
const fileName & local() const noexcept
Read access to local path component.
Definition: IOobjectI.H:208
const fileName & instance() const noexcept
Read access to instance path component.
Definition: IOobjectI.H:196
fileName path() const
The complete path.
Definition: IOobject.C:524
const fileName & rootPath() const
Return the Time::rootPath()
Definition: IOobject.C:512
fileName objectPath() const
The complete path + object name.
Definition: IOobjectI.H:214
The IOstreamOption is a simple container for options an IOstream can normally have.
streamFormat
Data format (ascii | binary)
An interval of (signed) integers defined by a start and a size.
Definition: IntRange.H:64
Output to file stream, using an OSstream.
Definition: OFstream.H:57
Inter-processor communications stream.
Definition: Pstream.H:63
static void broadcasts(const label comm, Type &arg1, Args &&... args)
Broadcast multiple items to all processes in communicator.
virtual bool read()
Re-read model coefficients if they have changed.
const word & system() const
Return system name.
Definition: TimePathsI.H:102
const fileName & globalCaseName() const
Return global case name.
Definition: TimePathsI.H:56
const word & constant() const
Return constant name.
Definition: TimePathsI.H:96
bool processorCase() const noexcept
Return true if this is a processor case.
Definition: TimePathsI.H:36
word findInstancePath(const fileName &directory, const instant &t) const
Definition: Time.C:821
A 2-tuple for storing two objects of dissimilar types. The container is similar in purpose to std::pa...
Definition: Tuple2.H:58
static constexpr int masterNo() noexcept
Process index of the master (always 0)
Definition: UPstream.H:451
static label worldComm
Default communicator (all processors)
Definition: UPstream.H:293
static bool & parRun() noexcept
Test if this a parallel run.
Definition: UPstream.H:433
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
bool good() const noexcept
True if the managed pointer is non-null.
Definition: autoPtr.H:145
static autoPtr< ISstream > readBlock(const label blocki, ISstream &is, IOobject &headerIO)
Read selected block (non-seeking) + header information.
static bool isCollatedType(const word &objectType)
True if object type is a known collated type.
static bool readHeader(IOobject &io, Istream &is)
Dummy input stream, which can be used as a placeholder for interfaces taking an Istream or ISstream....
Definition: dummyISstream.H:59
A class for handling file names.
Definition: fileName.H:76
Type
Enumerations to handle directory entry types.
Definition: fileName.H:81
static const fileName null
An empty fileName.
Definition: fileName.H:102
static bool isAbsolute(const std::string &str)
Definition: fileNameI.H:136
An encapsulation of filesystem-related operations.
Definition: fileOperation.H:69
static bool isFileOrDir(const bool isFile, const fileName &)
Helper: check for file (isFile) or directory (!isFile)
refPtr< dirIndexList > lookupAndCacheProcessorsPath(const fileName &objectPath, const bool syncPar) const
Lookup name of processorsDDD using cache.
virtual fileNameList readObjects(const objectRegistry &db, const fileName &instance, const fileName &local, word &newInstance) const
Search directory for objects. Used in IOobjectList.
fileName processorsPath(const IOobject &, const word &instance, const word &procDir) const
Generate path (like io.path) with provided instance and any.
virtual fileName objectPath(const IOobject &io, const word &typeName) const
Generate disk file name for object. Opposite of filePath.
fileOperation that assumes file operations are local.
virtual double highResLastModified(const fileName &, const bool followLink=true) const
Return time of last file modification.
fileName filePathInfo(const bool checkGlobal, const bool isFile, const IOobject &io, const bool search) const
Search for an object.
virtual autoPtr< OSstream > NewOFstream(const fileName &pathname, IOstreamOption streamOpt=IOstreamOption(), const bool valid=true) const
Generate an OSstream that writes a file.
virtual bool rmDir(const fileName &dir, const bool silent=false) const
Remove a directory and its contents.
virtual bool readHeader(IOobject &, const fileName &, const word &typeName) const
Read object header from supplied file.
virtual bool mvBak(const fileName &, const std::string &ext="bak") const
Rename to a corresponding backup file.
virtual fileNameList readObjects(const objectRegistry &db, const fileName &instance, const fileName &local, word &newInstance) const
Search directory for objects. Used in IOobjectList.
virtual time_t lastModified(const fileName &, const bool followLink=true) const
Return time of last file modification.
virtual fileName dirPath(const bool checkGlobal, const IOobject &io, const bool search) const
Search for a directory. checkGlobal : also check undecomposed.
virtual bool chMod(const fileName &, const mode_t) const
Set the file mode.
virtual off_t fileSize(const fileName &, const bool followLink=true) const
Return size of file.
virtual refPtr< dirIndexList > lookupProcessorsPath(const fileName &) const
Lookup name of processorsDDD using cache.
virtual bool rm(const fileName &) const
Remove a file, returning true if successful otherwise false.
virtual autoPtr< ISstream > NewIFstream(const fileName &) const
Generate an ISstream that reads a file.
virtual bool isFile(const fileName &, const bool checkGzip=true, const bool followLink=true) const
Does the name exist as a FILE in the file system?
virtual autoPtr< ISstream > readStream(regIOobject &, const fileName &, const word &typeName, const bool procValid=true) const
Reads header for regIOobject and returns an ISstream.
virtual bool isDir(const fileName &, const bool followLink=true) const
Does the name exist as a DIRECTORY in the file system?
virtual bool mkDir(const fileName &, mode_t=0777) const
Make directory.
virtual bool mv(const fileName &src, const fileName &dst, const bool followLink=false) const
Rename src to dst.
virtual bool ln(const fileName &src, const fileName &dst) const
Create a softlink. dst should not exist. Returns true if.
mode
Enumeration for pressure calculation mode.
Definition: pressure.H:359
An instant of time. Contains the time value and name. Uses Foam::Time when formatting the name.
Definition: instant.H:56
Registry of regIOobjects.
virtual const fileName & dbDir() const
Local directory path of this objectRegistry relative to the time.
const Time & time() const noexcept
Return time registry.
virtual fileName filePath() const
Return complete path + object name if the file exists.
A class for managing references or pointers (no reference counting)
Definition: refPtr.H:58
bool exists() const noexcept
True if expression is non-empty.
Definition: regExpCxxI.H:139
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
Definition: regIOobject.H:76
static bool masterOnlyReading
To flag master-only reading of objects.
Definition: regIOobject.H:87
splitCell * master() const
Definition: splitCell.H:113
label readDir()
Read directory and populate the 'available' files.
type
Volume classification types.
Definition: volumeType.H:66
A class for handling words, derived from Foam::string.
Definition: word.H:68
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Definition: className.H:121
fileName path(UMean.rootPath()/UMean.caseName()/"graphs"/UMean.instance())
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Definition: error.H:473
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:453
#define DetailInfo
Definition: evalEntry.C:37
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, false)
#define InfoInFunction
Report an information message using Foam::Info.
Namespace for OpenFOAM.
bool rm(const fileName &file)
Remove a file (or its gz equivalent), returning true if successful.
Definition: MSwindows.C:1012
time_t lastModified(const fileName &name, const bool followLink=true)
Return time of last file modification (normally follows symbolic links).
Definition: MSwindows.C:700
bool exists(const fileName &name, const bool checkGzip=true, const bool followLink=true)
Does the name exist (as DIRECTORY or FILE) in the file system?
Definition: MSwindows.C:633
bool mkDir(const fileName &pathName, mode_t mode=0777)
Make a directory and return an error if it could not be created.
Definition: MSwindows.C:515
mode_t mode(const fileName &name, const bool followLink=true)
Return the file mode, normally following symbolic links.
Definition: MSwindows.C:572
bool chMod(const fileName &name, const mode_t mode)
Set the file/directory mode, return true on success.
Definition: MSwindows.C:565
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition: MSwindows.C:598
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:372
bool rmDir(const fileName &directory, const bool silent=false)
Remove a directory and its contents (optionally silencing warnings)
Definition: MSwindows.C:1036
off_t fileSize(const fileName &name, const bool followLink=true)
Return size of file or -1 on failure (normally follows symbolic links).
Definition: MSwindows.C:684
double highResLastModified(const fileName &, const bool followLink=true)
Return time of last file modification.
Definition: MSwindows.C:707
IOerror FatalIOError
fileNameList readDir(const fileName &directory, const fileName::Type type=fileName::FILE, const bool filtergz=true, const bool followLink=true)
Read a directory and return the entries as a fileName List.
Definition: MSwindows.C:715
bool mvBak(const fileName &src, const std::string &ext="bak")
Rename to a corresponding backup file.
Definition: MSwindows.C:976
bool isFile(const fileName &name, const bool checkGzip=true, const bool followLink=true)
Does the name exist as a FILE in the file system?
Definition: MSwindows.C:666
bool cp(const fileName &src, const fileName &dst, const bool followLink=true)
Copy the source to the destination (recursively if necessary).
Definition: MSwindows.C:810
error FatalError
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
bool mv(const fileName &src, const fileName &dst, const bool followLink=false)
Rename src to dst.
Definition: MSwindows.C:947
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130
bool ln(const fileName &src, const fileName &dst)
Create a softlink. dst should not exist. Returns true if successful.
Definition: MSwindows.C:933
bool isDir(const fileName &name, const bool followLink=true)
Does the name exist as a DIRECTORY in the file system?
Definition: MSwindows.C:651
fileName search(const word &file, const fileName &directory)
Recursively search the given directory for the file.
Definition: fileName.C:624
word format(conversionProperties.get< word >("format"))
const volScalarField & cp